Sub FindColouredTextUp() ' Paul Beverley - Version 03.02.22 ' Find coloured text Dim v As Variable, rng As Range ' Check what the background (black) colour is Set rng = ActiveDocument.Content rng.Collapse wdCollapseEnd myBlack = rng.Font.Color ' Check for search colour variable varExists = False For Each v In ActiveDocument.Variables If v.Name = "tColour" Then varExists = True: Exit For Next v If varExists = False Then ActiveDocument.Variables.Add "tColour", 0 searchColour = ActiveDocument.Variables("tColour") initialPosition = Selection.Start ' If no text is selected, search for next coloured bit If Selection.Start = Selection.End Then GoTo FindNext ' If some text is selected, see what colour it is; ' then go find more text of that colour. searchColour = Selection.Font.Color If searchColour < 0 Then searchColour = 0 ActiveDocument.Variables("tColour") = searchColour If searchColour > 0 Then GoTo FindNext Selection.Start = Selection.End ' Go and find the previous non-black colour Set rng = ActiveDocument.Content theEnd = rng.End Do Set rng = ActiveDocument.Content Set rng2 = ActiveDocument.Content rng.End = Selection.End With rng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Font.Color = myBlack .Wrap = wdFindStop .Replacement.Text = "" .Forward = False .MatchWildcards = False .MatchWholeWord = False .MatchSoundsLike = False .Execute End With ' Examine the character before the beginning of the find rng2.Start = rng.Start - 1 rng2.End = rng.Start ' If the next bit is still black, find the end of that Do While rng2.Font.Color = myBlack rng.Collapse wdCollapseStart rng.Find.Execute rng2.Start = rng.Start - 1 rng2.End = rng.Start Loop rng.Collapse wdCollapseStart rng.Find.Execute rng.Collapse wdCollapseEnd rng.End = rng.Start + 1 colourHere = rng.Font.Color rng.Select myResponse = MsgBox("This colour? (Cancel = any colour)", vbQuestion + vbYesNoCancel) Selection.Collapse wdCollapseStart If myResponse = vbCancel Then ActiveDocument.Variables("tColour") = 0 Exit Sub End If If rng.End = theEnd Then Exit Sub Loop Until myResponse = vbYes ActiveDocument.Variables("tColour") = colourHere GoTo finish FindNext: If searchColour = 0 Then Set rng = ActiveDocument.Content Set rng2 = ActiveDocument.Content rng.End = Selection.End With rng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Font.Color = myBlack .Wrap = wdFindStop .Replacement.Text = "" .Forward = False .MatchWildcards = False .Execute End With If rng.Find.Found = True Then ' Examine the character after the end of the find rng2.Start = rng.Start - 1 rng2.End = rng.Start ' If the next bit is still black, find the end of that Do While rng2.Font.Color = myBlack rng.Collapse wdCollapseStart rng.Find.Execute rng2.Start = rng.Start - 1 rng2.End = rng.Start Loop rng.Collapse wdCollapseStart rng.Find.Execute rng.Collapse wdCollapseEnd End If GoTo finish Else Set rng = ActiveDocument.Content rng.End = Selection.End foundHlight = False With rng.Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Font.Color = searchColour .Wrap = wdFindStop .Replacement.Text = "" .Forward = False .MatchWildcards = False .Execute End With End If finish: If searchColour = 0 Then rng2.Start = rng.End rng2.Select Else Set rng2 = rng.Duplicate End If ' Flash the range For i = 1 To 3 DoEvents myTime = Timer Do Loop Until Timer > myTime + 0.06 Selection.Collapse wdCollapseStart DoEvents myTime = Timer Do Loop Until Timer > myTime + 0.08 rng2.Select Next i rng.Collapse wdCollapseStart rng.Select If Selection.Start = initialPosition Then Beep End Sub