Hello guys. In the code below, I am trying to compare 2 column on Worksheet(DUMPSheet) (this worksheet has already been activated in the code before.) and add the missing cell into Worksheet(DTSheet). When trying to execute the code I get the "Application-defined or Object-defined error" Error.
Code:
Dim REFNO_GE As Variant
REFNO_GE = Range("A2:A" & Range("A" & Rows.Count).End(xlUp).row).Value
Dim REFNO_DT As Variant
REFNO_DT = Range("K2:K" & Range("K" & Rows.Count).End(xlUp).row).Value
Dim x, y As Variant
Dim match As Boolean
Dim GECounter, DTCounter As Long
GECounter = 2
DTCounter = LastDTRow + 1
For Each x In REFNO_GE
match = False
For Each y In REFNO_DT
If x = y Then match = True
Next y
If Not match Then
Worksheets(DUMPSheet).Range(Cells(GECounter, 7)).Select
Selection.Copy
Worksheets(DTSheet).Range(Cells(DTCounter, 1)).Select
Selection.Paste
DTCounter = DTCounter + 1
End If
GECounter = GECounter + 1
Next