Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-22-2013, 07:11 PM
Chayes Chayes is offline Identify certain text and move all phrases containing it down a line Windows XP Identify certain text and move all phrases containing it down a line Office 2003
Advanced Beginner
Identify certain text and move all phrases containing it down a line
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default Identify certain text and move all phrases containing it down a line

Hi All



I need some help with some VBA code please.

I have to identify all stock numbers including the letters "BX" and move each occurrence down a line.

For example

John Smith
244BX23

Alan Jones
123658BX235

Helen Smith
5698BX174


Would become

John Smith

244BX23

Alan Jones

123658BX235

Helen Smith

5698BX174

can someone advise?

There could be up to 6 digits before the "BX" , and up to 3 after it in any stock number.


Grateful for any help.
Reply With Quote
  #2  
Old 11-23-2013, 12:56 AM
macropod's Avatar
macropod macropod is offline Identify certain text and move all phrases containing it down a line Windows 7 32bit Identify certain text and move all phrases containing it down a line Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For the data you've posted, you could do this with a wildcard Find/Replace, where:
Find = ([!^l^13])([^l^13])([0-9]@BX)
Replace = \1\2\2\3
The F/R expressions are more elaborate than they probably need to be because: (a) I don't know whether your lines are separated by newline characters (↵) or paragraph breaks (¶); and (b) I don't know whether the extra space already exists in some cases.

No code required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-26-2013, 01:16 PM
Chayes Chayes is offline Identify certain text and move all phrases containing it down a line Windows XP Identify certain text and move all phrases containing it down a line Office 2003
Advanced Beginner
Identify certain text and move all phrases containing it down a line
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Smile

Hi

Ok thanks for you help. This worked perfectly , first time.

I'm grateful for your time and expertise.





Best Wishes
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Identify certain text and move all phrases containing it down a line Selecting text between two key phrases Chayes Word VBA 6 06-24-2012 06:54 PM
multiple text boxes collapse on move apricoti Word 2 01-26-2012 05:55 PM
Identify certain text and move all phrases containing it down a line Line breaks at each line in Web text ahazelwood Word 5 01-06-2011 02:37 PM
Identify certain text and move all phrases containing it down a line Automatically Hyperlink phrases TinaIgnatiev Word 1 12-22-2010 01:42 PM
I want to change the Move Graphics with text default. Renee Hendershott Office 0 01-22-2006 03:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:26 AM.


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