View Single Post
  #1   Report Post  
jaidinesh jaidinesh is offline
Junior Member
 
Posts: 0
Default how can we find and replace hyphen to endash within numbers

Hi Paul,

Kindly correct my code in below:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "([0-9])-([0-9])"
.Replacement.Text = "\1^=\3"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Before Run:55-66
After Run:556–6