|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
宏代码为:Sub Macro1()
Dim arr, brr, d As Object, dic As Object
Columns(2).Interior.ColorIndex = xlNone
Columns(3).ClearContents
Set d = CreateObject("scripting.dictionary")
Set dic = CreateObject("scripting.dictionary")
arr = Range("a1:a" & Range("a65536").End(xlUp).Row)
brr = Range("b1:b" & Range("b65536").End(xlUp).Row)
For i = 1 To UBound(brr)
d(brr(i, 1)) = ""
Next i
For i = 1 To UBound(arr)
dic(arr(i, 1)) = ""
Next i
For i = 1 To UBound(brr)
If Not dic.exists(brr(i, 1)) Then Cells(i, 2).Interior.ColorIndex = 3
Next i
For i = 1 To UBound(arr)
If Not d.exists(arr(i, 1)) Then arr(i, 1) = ""
Next i
Range("c1").Resize(UBound(arr), UBound(arr, 2)) = arr
End Sub |
|