You could just delete {1,}, but that might make the code run quite slowly. Instead, try:
Sub Demo() Application.ScreenUpdating = False Dim i As Long, StrTxt As String With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "[0-9]{1,}" .Replacement.Text = "" .Format = True .Highlight = True .Forward = True .Wrap = wdFindStop .MatchWildcards = True .Execute End With Do While .Find.Found If .HighlightColorIndex = wdYellow Then StrTxt = "" For i = 1 To Len(.Text) StrTxt = StrTxt & "x" Next .Text = StrTxt .HighlightColorIndex = wdBlack End If .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub




Reply With Quote
