这是用VBA写的
Sub test()
Dim i As Integer
Dim m As Integer
m = Sheets("Sheet2").[A65536].End(xlUp).Row
For i = 1 To m Step 1
If Sheets("Sheet2").Range("A" & i).Value Like "*杭州*" Then
'Sheets("Sheet2").Range("A" & i).Interior.Color = RGB(255, 0, 0)
Sheets("Sheet2").Range("B" & i).Value = "浙江省"
End If
Next i
End Sub
感觉还是Python更快一些
这是用VBA写的
Sub test()
Dim i As Integer
Dim m As Integer
m = Sheets("Sheet2").[A65536].End(xlUp).Row
For i = 1 To m Step 1
If Sheets("Sheet2").Range("A" & i).Value Like "*杭州*" Then
'Sheets("Sheet2").Range("A" & i).Interior.Color = RGB(255, 0, 0)
Sheets("Sheet2").Range("B" & i).Value = "浙江省"
End If
Next i
End Sub