Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-11-2015, 09:25 PM
gmayor's Avatar
gmayor gmayor is offline wildcard search and add (not replace) sequential numbers in front Windows 7 64bit wildcard search and add (not replace) sequential numbers in front Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with wildcard search mysterytramp Word 0 05-13-2015 10:40 AM
search and replace a field containing text and numbers H28Sailor Word 6 09-11-2014 01:00 AM
Issue with Wildcard Search and Replace linusthedog Word 3 09-04-2014 03:32 PM
Where is the error in my wildcard search? Ulodesk Word 10 06-30-2014 01:46 PM
Wildcard search help. Kempston Word 0 11-13-2009 03:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft