Removing Extra Paragraph Marks

by Allen Wyatt
(last updated August 20, 2016)


There may be times when you are working with a document when you have a need to remove extra paragraph marks. This is particularly true if you are working with an ASCII file or a file that may have originally been formatted with another word processor. This process of manually removing extra paragraph marks can be very time consuming.

If you find yourself in this situation, you may find this macro of interest. It removes extra paragraph marks from a document. When it is completed, there should not be even two paragraph marks in a row in your document.

Sub ReplacePara()
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
        .Text = "^p^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    While Selection.Find.Found
        Selection.MoveRight Unit:=wdCharacter, Count:=1
        Selection.MoveLeft Unit:=wdCharacter, Count:=2
End Sub

There are two parts to this macro. The first part—which relies on the Selection.Find method—uses Word's built-in find and replace capabilities to find all instances of two paragraph marks in sequence. The macro doesn't replace the sequential paragraph marks; it simply finds them. Then the second part of the macro kicks in—using the Selection.Find.Found—property to delete the second of the two sequential paragraph marks.

The reason this approach is taken is because it leaves the formatting correct on the remaining paragraph mark. For instance, if the two sequential paragraph marks use different formatting from each other, the formatting of the first paragraph mark remains unchanged. If you simply replaced the sequential paragraph marks with a single paragraph mark, it is possible that you may not have the formatting exactly as you want when the replacing is finished.

Note that Selection.Find.Found is used as a "flag" for the While loop. This property reflects the status of the latest Find operation. If True then the search was successful; if False, then there was nothing found (and, therefore, nothing to change).


If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (998) applies to Microsoft Word 2007, 2010, 2013, and 2016.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Understanding Operators

At the heart of working with Excel is the process of creating formulas that calculate results based on information within ...

Discover More

Choosing an Easy Exterior Wood Stain

One of the finishing touches that need to be applied to any wood project is, well, the finish. Wood stain is a natural ...

Discover More

Rotating Fractions in a Text Box

Rotating graphics in Word is not always straight-forward, but it can be done. The tools on the Drawing toolbar allow you ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Replacing Spaces in Part Numbers with Dashes

Word has a power capability to search for information and then replace that information in some way. Finding the right ...

Discover More

Speeding Up Cursor Movement

If you use the arrow keys to move the insertion point through the document, you may have noticed that it can be slow ...

Discover More

Replacing Random Text with Your Own Text

Word includes a little-known function that allows you to put "filler text" into your document. If you want this function ...

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 - 4?

2016-10-06 08:07:55

Lee Batchelor

Thanks for the tip, Truis! I shall modify my macro.

- Lee

2016-10-05 23:37:04


Great stuff! This code is exactly what I needed for a macro that tidies up the formatting of text pasted in from elsewhere. In this case, it's important to use Backspace, because I want Word to retain the formatting of the second paragraph mark, not the first. That bit's working well.

Unfortunately, I'm having trouble with the While/Wend, because it's deleting *too* many characters, not just the paragraph marks. I think that's because the source of what my macro is pasting in (as unformatted text) is the content of a Content Control. Two steps forward, one step back...!

Tip! If finding "^p^p" finds no results (when you know they exist), try finding "^013^013" instead. That's the full character code, rather than the "^p
", which is like an internal shortcut key.

2016-08-28 08:49:47

Lee Batchelor

Yes, the macro crashes Word 2007 too, when there is a table in the document.

I tried the Find and Replace method with or without a table. It doesn't get rid of the empty paragraphs in Word 2007. Why not?

I typed:
Find what: ^p^p
Replace with: ^p

It found two paragraphs in a row (the first with content, the second with nothing, which must be deleted), and it didn't do anything!!

2016-08-27 11:49:02

Lyn Imeson

This macro doesn't seem to work if there are tables in the file. It makes Word crash.
Could anyone suggest a modification?

2016-08-25 08:08:47

Lee Batchelor

Good catch, Lisa!

I just ran the macro without removing the space, and only those empty paragraphs without the extra space were cleared.

I wonder if someone can modify this macro to account for the extra space.

2016-08-24 11:53:31

Lisa Herider

I have found many paragraph marks preceded by a spaceband. Before you run this macro, do a search/replace for the spaceband and ^p in your search string replacing with just the ^p. That way when you run the macro it will find all the paragraph returns.

2016-08-22 12:30:58

Macro is faster

Using a macro is much faster if someone hit enter 20+ times. Set it one and give it a keyboard shortcut, or assign a button to it in the QAT and you are all set. Saves a ton of time.

2016-08-22 10:44:29

Sarita King

Macro a find and replace with the following
FIND ^p^p

run it until it stops.
Note bonus the code for tab is ^t

2016-08-22 03:34:59

George JasonSmith

I agree with Min (below) and have been using fAnd and replace to do this for years. also I find it easier to type ^p ^p into the find box and ^p into the replace, rather than navigating the Choose box

2016-08-21 09:09:18

Lee Batchelor

Agreed, Min. I've used your method too. I've also noticed it can mess up the formatting of some paragraphs that have styles applied when I fill in the Replace field with nothing (leave it blank). By placing one paragraph mark in the Replace box, you still have one empty paragraph where the user had two originally, correct? Empty paragraphs are a no-no.

2016-08-20 10:01:49

Min Edwards

Actually you don't need a macro to do this do you? I take out those multiple paragraph marks just with Find/Replace. Some of my clients add multiple marks instead of a page break so you can imagine how many paragraph marks they insert. With Find choose Special then choose Paragraph Mark, then another paragraph mark. In the Replace box, just put one Paragraph mark. You may have to do this multiple times if there are lots of para marks strung together.

2016-08-20 09:19:40

Lee Batchelor

What a wonderful macro! I often import documents where the person has used the Enter key to create extra paragraph spacing, instead of controlling the Before and After paragraph spacing using styles. So many people treat word processors like typewriters, which is mostly wrong.

It's so sad that to create handy macros like this one, we must learn a very complex language like VBA. We can’t expect Microsoft to anticipate all our individual writing needs, but if we only had a tool that easily lets us create macros, we could customize Word the way we want it. The Record Macro tool is handy but very limited.

Thanks for this wonderful macro!

This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.