Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-19-2017, 04:21 AM
Chayes Chayes is offline VBA to find any nine-figure number Windows XP VBA to find any nine-figure number Office 2003
Advanced Beginner
VBA to find any nine-figure number
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default VBA to find any nine-figure number

HI All

I need to find and replace with a carriage return all occurrences of everything between a "£" sign and the next nine-figure number.

So for example all pattern like

£4.00 $0.42
477489528

Would be found and replaced with a carriage return.

The code would need to run through and replace all such instances. It always starts with the £ sign and ends with a nine-figure number.



Can someone help with some code for this? Grateful for any advice.

Best Wishes ,
Reply With Quote
  #2  
Old 05-19-2017, 05:03 AM
eduzs eduzs is offline VBA to find any nine-figure number Windows 10 VBA to find any nine-figure number Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default

Try this:

With Selection.Find

.Text = "£*[0-9]{9}"
.Replacement.Text = Chr(13)
.MatchWildcards = True
.Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue

End With
__________________
Backup your original file before doing any modification.
Reply With Quote
  #3  
Old 05-19-2017, 06:06 AM
Chayes Chayes is offline VBA to find any nine-figure number Windows XP VBA to find any nine-figure number Office 2003
Advanced Beginner
VBA to find any nine-figure number
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

Hi

Yes , that's perfect! Thanks very much for your help.


Best Wishes ,
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Captioning each figure with the chapter number jatin1990 Word 6 03-31-2015 02:34 PM
How to stop caption number reset (Figure 1) strathglass Word 5 06-17-2013 06:06 AM
VBA to find any nine-figure number Figure number for repeated use in paragraph rahul4msoffice Word 1 05-01-2013 11:35 PM
Refering figure number too text danzi Word 1 01-20-2012 12:13 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:44 PM.


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