Hi,
I have this code here that basically will search through a data list "A" by searching for each data element in list "L". If there is a match, then the element will be highlighted in A. Is there a way to highlight every element in data list L that is found in A? In other words, I would like the end product to have all found elements to be highlighted on both data list A and L. All items that havent been found would be unhighlighted. Any help would be awesome- thanks.
Sub FindAndHighlight()
Dim FirstAddx As String
Dim LastRow As Long
Dim N As Long
Dim R As Long
Dim SrchRng As Range
Dim SrchRslt As Range
Dim SrchValue As Variant
N = Cells(Rows.Count, "L").End(xlUp).Row
For R = 1 To N
SrchValue = Cells(R, "L")
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set SrchRng = Range("A1", Cells(LastRow, "A"))
Set SrchRslt = SrchRng.Find(What:=SrchValue, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchORder:=xlRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not SrchRslt Is Nothing Then
FirstAddx = SrchRslt.Address
Do
SrchRslt.Interior.ColorIndex = 6
Set SrchRslt = SrchRng.FindNext(SrchRslt)
Loop While SrchRslt.Address <> FirstAddx And Not SrchRslt Is Nothing
End If
Next R
End Sub
Bookmarks