View Single Post
 
Old 04-09-2018, 12:02 AM
Jovan Yong Jovan Yong is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2018
Posts: 5
Jovan Yong is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You can do that with a single search and replace. If it needs to be a macro, recording that and doing a quick tidy gives you this macro.
Code:
Sub Macro2()
  Options.DefaultHighlightColorIndex = wdBrightGreen
  With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Text = "PQC70([1-5])"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End Sub
Refer to the attached graphic to see what the search and replace dialog would look like. Note: I decided to remove the replacewith text and also check the Whole Word setting after capturing the screen shot but the result is essentially the same.
Hmm, how about if i just want to select PQC , everything related to it is selected?
Because the number after PQC is randomize
Reply With Quote