Code:
Sub kTest()
Dim ka, k(), i As Long, n As Long
ka = Range("a1").CurrentRegion.Resize(, 2)
ReDim k(1 To UBound(ka, 1), 1 To 1)
With CreateObject("scripting.dictionary")
.comparemode = 1
For i = 1 To UBound(ka, 1)
.Item(ka(i, 2)) = Empty
Next
For i = 1 To UBound(ka, 1)
If Not .exists(ka(i, 1)) Then
n = n + 1
k(n, 1) = ka(i, 1)
End If
Next
End With
If n Then
Columns(1).ClearContents
[a1].Resize(n).Value = k
End If
End Sub
it is basically used to compare two column (A,B) and find the missing in column B and paste it in A. but i did not understand the code and i got this on Google.
Last edited by a moderator: