View Single Post
 
Old 07-11-2015, 09:25 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

With your example, which is not consistently formatted, e.g. Line 4 format has an extra space compared with Line 3, the following should do the job

Code:
Dim oRng As Range
Dim i As Long
    Set oRng = ActiveDocument.Range
    i = 1
    With oRng.Find
        Do While .Execute(FindText:="[0-9]{1,5},[ 0-9]{1,2},", MatchWildcards:=True)
            oRng.Text = "(" & Format(i, "000") & ") " & oRng.Text
            oRng.Collapse 0
            i = i + 1
        Loop
    End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote