this is the code I have so far.This code helps me find the list of input "AAAA", "BBBB", "CCCC", "DDDD" and highlight the rows have that value. However; it only highlights the row has 1st input "AAAA", but not "BBBB", "CCCC", and "DDDD" row.
Sub FindMultiItemsInDoc()
Dim objListDoc As Document
Dim objTargetDoc As Document
Dim objParaRange As Range, objFoundRange As Range
Dim objParagraph As Paragraph
Dim strFileName, arrM As String
Dim arr() As String
strFileName = InputBox("Enter the full name of the list document here:")
arr = Split(strFileName, ",")
For i = LBound(arr) To UBound(arr)
arrM = arr(i)
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = arrM
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
If .Information(wdWithInTable) = True Then
.Rows(1).Range.HighlightColorIndex = wdYellow
End If
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
Next i
End Sub
|