Hey guys,
Just wondering, I keep getting error 91 when running the below:
Anyone lend a hand please I would greatly appreciate it?
Thanks in advance!
Just wondering, I keep getting error 91 when running the below:
VBA Code:
Sub HighlightCellIfValueExistsinAnotherColumn()
Dim ws As Worksheet
Dim i As Long
Dim j As Long
Dim LastRow As Long
Dim LastRow2 As Long
LastRow = Cells(Rows.Count, "Q").End(xlUp).Row
LastRow2 = Cells(Rows.Count, "A").End(xlUp).Row
For j = 2 To LastRow2
For i = 2 To LastRow
If ws.Range("A" & i).Value <> ws.Range("Q" & j).Value Then GoTo NextInteration
If ws.Range("A" & i).Value = ws.Range("Q" & j).Value Then
ws.Range("A" & i).Interior.ColorIndex = 4 'green
ws.Range("Q" & j).Interior.ColorIndex = 4 'green
GoTo NextInteration 'otherwise next interation
End If
NextInteration:
Next i
Next j
End Sub
Anyone lend a hand please I would greatly appreciate it?
Thanks in advance!