#1
|
|||
|
|||
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. |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
Hi
Ok thanks for you help. This worked perfectly , first time. I'm grateful for your time and expertise. Best Wishes |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Line breaks at each line in Web text | ahazelwood | Word | 5 | 01-06-2011 02:37 PM |
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 |