hi,
I am trying to get the following macro, to read column D and highlight any rows, which contain duplicate cells from column D.
Please view the attachment for further details, as to what the output should look like, when there is duplicate in column D.
test1.xlsx
The below code is throwing back a run-time error 9. I am little unclear what is causing this behavior.
Please advice further, if possible.
Sub test()
Dim rng As Range, c As Range, cfind As Range, rng1 As Range
Worksheets("room list").Activate
Set rng = Range(Range("D2"), Range("D2").End(xlDown))
Set rng1 = Range(Range("B2"), Range("B2").End(xlDown))
For Each c In rng
Set cfind = rng1.Cells.Find(what:=c.Value, lookat:=xlWhole)
If Not cfind Is Nothing Then c.Interior.ColorIndex = 3
Next c
End Sub
Many thanks
Bookmarks