Removing Spaces before a Note Mark

Written by Allen Wyatt (last updated September 5, 2026)

Kyra routinely uses footnotes and endnotes in the documents on which she works. She has noticed that, at times, there is a space just before the note mark within the main document. Kyra deletes them when she sees them, but she wonders if this is something she can do throughout the entire document, in a single pass.

The short answer is yes; you can. In fact, there are a couple of ways you can approach this task. The first is to use Find and Replace, in this manner:

  1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is available. (See Figure 1.)
  3. Figure 1. The Replace tab of the Find and Replace dialog box.

  4. Make sure the Use Wild Cards radio button is selected.
  5. In the Find What box, type a space followed by the following characters: @(^2)
  6. Put the following in the Replace With box: \1
  7. Click Replace All.

The pattern you use in step 4 is very important. You are telling Word you want to search for any number of spaces followed by a note mark. (That's the ^2 portion of the pattern.) Since the note mark indicator is contained within parentheses, it can be referenced in the Replace With box (step 5).

If you think that there might be tab characters or non-breaking spaces before your note marks, then change the Find What pattern (step 4) to the following:

[ ^s^t]@(^2)

This finds any number of spaces, non-breaking spaces, and tabs—in any combination or order—followed by a note mark. (Note that the opening bracket is followed by a space.)

There is one potential drawback to this approach—it affects note marks in all areas of the document, including the footnotes and endnotes themselves. In most instances this isn't an issue, but Kyra implied that she wanted to only make changes in the main document. If this is the case, then you won't want to click Replace All in step 6. Instead, you'll want to step through the potential changes and only make those that you desire.

If you truly want to affect only the note marks in the main document, then the best way to do that is by using a macro. Here is an approach that relies on a main macro and a helper macro:

Sub RemoveNoteSpaces()
    Dim J As Long

    With ActiveDocument
        For J = .Footnotes.Count To 1 Step -1
            If .Footnotes(J).Reference.StoryType = wdMainTextStory Then
                RemoveSpacesBeforeNote .Footnotes(J).Reference
            End If
        Next J

        For J = .Endnotes.Count To 1 Step -1
            If .Endnotes(J).Reference.StoryType = wdMainTextStory Then
                RemoveSpacesBeforeNote .Endnotes(J).Reference
            End If
        Next J
    End With
End Sub
Private Sub RemoveSpacesBeforeNote(ByVal noteRef As Range)
    Dim startPos As Long
    Dim notePos As Long
    Dim ch As String

    notePos = noteRef.Start
    startPos = notePos

    ' Work backward from the note reference
    Do While startPos > ActiveDocument.Content.Start
        ch = noteRef.Document.Range(Start:=startPos - 1, End:=startPos).Text
        If ch = " " Or ch = ChrW(160) Or ch = vbTab Then
            startPos = startPos - 1
        Else
            Exit Do
        End If
    Loop

    ' Delete unwanted characters
    If startPos < notePos Then
        noteRef.Document.Range(Start:=startPos, End:=notePos).Delete
    End If
End Sub

In the main macro (RemoveNoteSpaces), processing is done from the end of the footnote and endnote collections. This approach within a macro is always a good idea when you are deleting document text. If the footnote or endnote is within the main document (meaning the StoryType is wdMainTextStory), then the helper macro is called.

The helper macro (RemoveSpacesBeforeNote) simply examines characters before the note marker. If the characters are spaces, non-breaking spaces, or tab characters, then they are deleted.

The macro runs very quickly. And, because the main macro only works within the main document, nothing within the footnotes or endnotes themselves are affected.

Note:

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 (14000) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.

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. ...

MORE FROM ALLEN

Multi-Page Print Preview

Many users rely on Print Preview to show them what their printout will look like. When using Print Preview, you aren't ...

Discover More

Moving a Worksheet

Need to move a worksheet from one place to another in the same workbook? Here are two easy ways to make the move.

Discover More

Resolving Revisions

You've reviewed the changes that were made to your workbook using the Highlight Changes tool. Now you need to remove the ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!

More WordTips (ribbon)

Using Cross-References in Footnotes

Need to make a cross-reference from one footnote to another footnote? You can do it if you throw bookmarks into the mix, ...

Discover More

Changing Space between the Footnote Separator and Footnotes

When you add footnotes to a document, Word separates those footnotes from the document body with a separator line. Here's ...

Discover More

Correctly Numbering Footnotes in a Chapter

Word is very flexible when it comes to adding footnotes to your document. If you have multiple sections within that ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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}] (all 7 characters, in the sequence shown) 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 5 + 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

Videos
Subscribe

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.