#1
|
|||
|
|||
Inserting blank lines but only once no matter how many times code is run
I have lines of text and I want to use VBA to insert blank lines but only once, no matter how many times I run the code. So:
This is line one. This is line two. Becomes: This is line one. This is line two. I have a find/replace that searches for".^p[A-Z]" and replaces it with ".^p^p[A-Z]". The [A-Z] is supposed to find any capital letter on the next line and replace it with the same capital letter. If my find /replace is ".^p" / ".^p^p" then running it again will insert a blank line each time I run it. Having it look for a capital letter after the ".^p" will prevent that. But when I run it nothing happens. Is what I want to do possible? Thank you. |
#2
|
||||
|
||||
Search for
([!^13]^13)([A-Z]) with the wildcard option set Replace with \1^p\2
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
That did it. Brilliant! Thank you! I knew it was something along those lines but I couldn't quite get there.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
syntax for inserting blank line before inserting table and after a line or paragraph | SamDsouza | Word VBA | 8 | 08-04-2019 11:10 PM |
vba code for folder name, subfolder directory, file name & revision times | klpw | Excel Programming | 2 | 12-24-2015 12:31 AM |
Inserting blank columns | Guloluseus | Excel | 2 | 06-24-2015 09:07 AM |
Getting blank lines instead of supressed lines. | Welshie82 | Mail Merge | 2 | 11-14-2011 01:41 AM |
How to turn all blank lines into non-blank for legal forms | sieler | Word | 3 | 04-12-2009 01:38 PM |