Thread: [Solved] code to rewrite numbers
View Single Post
 
Old 02-10-2014, 06:06 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub Macro1()
Dim oRng As Word.Range
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting
  Set oRng = ActiveDocument.Range
  With oRng.Find 'Selection.Find
    .Text = "([0-9]{1,})(:)([0-9]{1,})"
    .Replacement.Text = "\3\2\1"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote