I currently have a macro that searches for "STOP:" in a table. I would like to also search for "NEXT:" at the same time (want to change the paragraph to red.
How can I do this?
See current code below. Thanks!
Code:
Dim r As Range
Dim Para As Paragraph
Dim aCell As Cell
Dim myTable As Table
'Find all Tip Paragraphs and turn red
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Set myTable = ActiveDocument.Tables(1)
For Each aCell In myTable.Columns(3).Cells
Set r = aCell.Range
For Each Para In aCell.Range.Paragraphs
With Para.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "STOP:"
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found = True
With .Duplicate
If .InRange(r) Then
.Paragraphs.First.Range.Font.Color = wdColorRed
End If
End With
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Next
Next
End Sub