Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-20-2017, 01:24 PM
Ziad El Hachem Ziad El Hachem is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Mar 2017
Posts: 2
Ziad El Hachem is on a distinguished road
Question Select and Delete 2 lines after each blank line


Dear all,

I have large amounts of text that can be seen as the following pattern:

Good Line
(empty line)
Bad Line
Bad Line
Good Line
(empty line)
Bad Line
Bad Line

Etc...
I would really like to delete all blank lines along with the next 2 bad lines. I only know this is possible in VBA! but I am not proficient in it (my experience is with excel VBA)
Reply With Quote
  #2  
Old 03-20-2017, 02:55 PM
slaycock slaycock is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Sep 2013
Posts: 82
slaycock is on a distinguished road
Default

Can you describe what the good and bad lines look like a little better.
Reply With Quote
  #3  
Old 03-20-2017, 03:46 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 15,871
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by Ziad El Hachem View Post
I would really like to delete all blank lines along with the next 2 bad lines. I only know this is possible in VBA!
You almost certainly don't need VBA for this; a wildcard Find/Replace would most likely do the job, where:
Find = ([^13^l])[^13^l]{1,}
Replace = \1
This assumes there are no stray spaces, tabs, etc. in your 'blank' lines.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #4  
Old 03-21-2017, 08:34 AM
Ziad El Hachem Ziad El Hachem is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Mar 2017
Posts: 2
Ziad El Hachem is on a distinguished road
Default

what does ^| do?
the find search, even using wildcards is not working...

A sample of the texts I am trying to arrange (standard youtube caption files):

1
00:00:04,350 --> 00:00:07,609
This tutorial will show how to seamlessly transfer

2
00:00:07,609 --> 00:00:11,059
a model from Revit structure to ETABS

3
00:00:11,059 --> 00:00:14,559
at then back again to Revit using
Reply With Quote
  #5  
Old 03-21-2017, 06:55 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 15,871
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by Ziad El Hachem View Post
what does ^| do?
Nothing that I'm aware of - it's not in the expression I posted...
Quote:
Originally Posted by Ziad El Hachem View Post
the find search, even using wildcards is not working...
It might if you used the actual Find expression I posted! If not, the spacing may simply reflect your paragraph space before/after settings, which no amount of Find/Replace could fix. If you attach an actual document to a post, with some representative data, we could provide more advice. You can do that via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
blank find expand
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line Numbering & Blank Lines Ephasa Word 5 05-17-2016 12:23 AM
Quickly select lines of certain colour RFoudy PowerPoint 27 09-09-2014 12:35 AM
remove blank lines in between jolinchew Excel 4 08-01-2013 06:09 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


All times are GMT -7. The time now is 02:49 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft