What does it mean?

Sorry, I am really a newbie.

I also used below code as an alternative, actually this is what I am trying to do as a whole but the error occurs at For-Each If c1=c2 line

Code:

Sub LookForMatches()
Dim dwg_x As Range, dwg_y As Range, c1 As Range, c2 As Range
Dim sym_x As Range, sym_y As Range, c3 As Range, c4 As Range
'set ranges
'Set i = Sheets("datay").Range("TEST")
Set dwg_x = Sheets("datax").Range("C5", Sheets("datax").Range("C" & Rows.Count).End(xlUp))
Set sym_x = Sheets("datax").Range("F5", Sheets("datax").Range("F" & Rows.Count).End(xlUp))
Set DWG_COL = Sheets("datay").Range("A2:P2").Find("DWG. NO", , xlValues, xlWhole, , , True)
Set SYM_COL = Sheets("datay").Range("A2:P2").Find("SYM", , xlValues, xlWhole, , , True)
Set dwg_y = DWG_COL.EntireColumn
Set sym_y = SYM_COL.EntireColumn
'reset colour
dwg_x.Interior.Color = 16777215
dwg_y.Interior.Color = 16777215
sym_x.Interior.Color = 16777215
sym_y.Interior.Color = 16777215
'loop values in range
For Each c1 In dwg_x
If Not c1.Interior.ColorIndex = 16777215 And c1 <> "" And c1 <> 0 Then
For Each c2 In dwg_y
If c1 = c2 And c2.Address <> c1.Address Then
c1.Interior.Color = RGB(255, 255, 0)
c2.Interior.Color = RGB(255, 255, 0)
End If
Next c2
End If
Next c1
'loop values in next range
For Each c3 In sym_x
If Not c3.Interior.ColorIndex = 16777215 And c3 <> "" And c3 <> 0 Then
For Each c4 In sym_y
If c3 = c4 And c4.Address <> c3.Address Then
c3.Interior.Color = RGB(255, 255, 0)
c4.Interior.Color = RGB(255, 255, 0)
End If
Next c4
End If
Next c3
End Sub

Originally Posted by

**Yurik74**
Most likely that is because the code could find the value you are looking for and the range is nothing, so it can't assign the range.

Thanks for your kindness

## Like this thread? Share it with others