A中的第4列是否在B中的第9列包含
Sub 宏1()
m = Sheets("B").UsedRange.Rows.Count
For i = 3 To 3 'Sheets("A").UsedRange.Rows.Count
s = Sheets("A").Cells(i, 4)
Sheets("A").Cells(i, 5) = ""
Sheets("A").Cells(i, 5).Interior.ColorIndex = 0 '设置为无色
If s <> "" Then
For j = 2 To m
ss = Sheets("B").Cells(j, 9)
If s <> "" And InStr(ss, s) Then
Sheets("A").Cells(i, 5) = "存在"
Sheets("A").Cells(i, 5).Interior.ColorIndex = 3 '设置为红色
Exit For
End If
Next
End If
Next
MsgBox ("完成")
End Sub
转载:https://blog.csdn.net/zhoulin777/article/details/102594072
查看评论