Hi,
I'm just learning VBA so apologies in advance.
The goal is to compare one set of columns to another, row by row, and take an action if a row match is not found. I've trimmed down the code to highlight the area where i'm getting my error.
Error seems to be occuring with the comparison 'cellA.value = cellB.value'
What am I doing wrong here?
I'm just learning VBA so apologies in advance.
The goal is to compare one set of columns to another, row by row, and take an action if a row match is not found. I've trimmed down the code to highlight the area where i'm getting my error.
Code:
Sub dupes()
Dim startcellA As Range
Dim startcellB As Range
Dim columnA As Range
Dim columnB As Range
Dim match As Boolean
Dim cellA As Range
Dim cellB As Range
Set startcellA = Range("b1")
Set columnA = Range("b1", startcellA.End(xlDown))
Set startcellB = Range("L1")
Set columnB = Range("L1", startcellB.End(xlDown))
Set cellA = Range("B1")
Set cellB = Range("L1")
For Each cellA In columnA
match = False
For Each cellB In columnB
If cellA.Value = cellB.Value Then match = True
Next cellB
If Not match Then {do some stuff here}
Next cellA
End Sub
What am I doing wrong here?