Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-27-2023, 01:30 AM
gmayor's Avatar
gmayor gmayor is offline Delete empty lines Windows 10 Delete empty lines Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following would leave one empty paragraph between paragraphs, but it would be far better to remove all empty paragraphs and apply styles to give the spacing you require. See also Replace using wildcards

Code:
Sub Macro1()
    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "^13{2,}"
        .Replacement.Text = "^p^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete empty lines A way to delete when 2nd column is empty gavi12 Word VBA 1 04-04-2020 05:42 AM
Delete empty lines Delete row with empty cel in a table vibor Word VBA 9 05-03-2015 05:42 AM
Delete empty lines Remove empty lines at the top of every page dexter30 Word VBA 2 08-05-2013 08:37 PM
regular expressions for empty lines eNGiNe Word 1 01-21-2013 06:38 AM
Deleting empty lines lostsoul62 Word 5 04-16-2012 04:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:45 AM.


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