I would like to highlight matching values in two different ranges and worksheets using VBA.
Worksheet #1 is named "OVR" with the range S2:V100 (where the highlighted values should show).
Worksheet #2 is named "LS" with the range A2:A101 containing a list of names.
My goal is to highlight all the cells in the range S2:V100 (from the "OVR" worksheet) that have a match with one of the cells in the range A2:A101 (from the "LS" worksheet).
I would like to integrate it to existing VBA for this file.
Sub FindReference()
LR1 = Worksheets("LS").Cells(Rows.Count, "A").End(xlUp).Row
LR2 = Worksheets("OVR").Cells(Rows.Count, "A").End(xlUp).Row
Set rng1 = Worksheets("LS").Range("A2:A101" & LR1)
Set rng2 = Worksheets("OVR").Range("S2:V100" & LR1)
For Each rCell In rng1
rCell.Interior.ColorIndex = xlNone
rCell.Validation.Delete
result = WorksheetFunction.CountIf(rng2, rCell)
If result > 0 Then rCell.Interior.Color = vbGreen
Next
End Sub