If Range("A" & i) = "" Then Exit Do '空白跳出
If Range("F2") = Range("A" & i) And Range("G2") = Range("B" & i) Then Range("I2") = "OK" Else Range("I2") = "NO"
End
Loop
End Sub作者: 准提部林 時間: 2015-10-11 12:22
Sub AZ1011()
Dim xR As Range, xD
Set xD = CreateObject("Scripting.Dictionary")
'以AB欄值為KEY納入字典檔
For Each xR In Range([A2], [A65536].End(xlUp))
xD(xR & xR(1, 2)) = ""
Next
'以FG欄值為KEY比對是否存在於字典檔
For Each xR In Range([F2], [F65536].End(xlUp))
If xD.Exists(xR & xR(1, 2)) Then xR(1, 4) = "OK" Else xR(1, 4) = "NO"
Next
End Sub作者: mark761222 時間: 2015-10-11 13:43