Sub Ex()
Set d = CreateObject("Scripting.Dictionary")
With Sheets(2)
For Each a In .Range(.[A1], .[A65536].End(xlUp))
d(a.Value) = a.Offset(, 1)
Next
With Sheets(1)
For Each a In .Range(.[A1], .[A65536].End(xlUp))
a.Offset(, 3) = d(a.Value)
Next
End With
End With
End Sub
這是我搜尋到的程式碼,比對相符取代這點沒問題
但我想比對不相符的保留原本儲存格內的值,這點如何修改?
另外這是同一個活頁簿內比對,若是我想跨不同活頁簿比對又該如何修改呢?