Finding Text Using a Specific Highlighting Color

by Allen Wyatt
(last updated July 21, 2018)

Amir uses different highlighting colors throughout his documents. When he uses Find and Replace to find highlighted text, it treats all highlighting colors the same. Amir would like, specifically, to use Find and Replace to locate only text highlighted in yellow, having it ignore any other highlighting color used in the document.

Before getting into how to possibly do this, it is important to discuss terms for a moment. When using the term "highlighting color," some people think that is referring to the color applied to some particular text; it is not. Highlighting doesn't change the font's color. Highlighting is accomplished by using the Text Highlight Color tool, which is available in the Font group on the Home tab of the ribbon. (See Figure 1.)

Figure 1. Word allows you to highlight text using different colors.

When you use the Find and Replace dialog box, you can specify that you want to search for text that is highlighted. (Put the insertion point in the Find box, click Format, then click Highlight.) When you click on Find Next, Word selects the next highlighted text, regardless of the color used to highlight that text. In other words, you cannot specify that you only want to find text highlighted in yellow or blue or green or any other color; it is all treated the same.

We haven't been able to find any reliable way around this. Some information we've seen indicates that Word will only find whatever highlight color is specified in the Text Highlight Color tool, but this is not true. Other folks have indicated that if you select some highlighted text (that is highlighted with the color you want to find) before displaying the Find and Replace dialog box, only that highlight color will be found when you click Find Next. This, too, is not true. In all cases, Find Next will find any highlighted text, irrespective of color used for highlighting.

The only way around this is to use a macro to do the finding. VBA allows you to detect the color used to highlight text, which is why this approach will work. The following macro uses Find and Replace to do the finding, but then it checks to see what the HighlightColorIndex property is for what was found. If it is equal to wdYellow (an enumeration for the color yellow), then the text is selected and the macro is exited.

Sub FindNextYellow()
    With Selection.Find
        .Text = ""
        .MatchWildcards = False
        .Forward = True
        .Wrap = wdFindContinue
        .Highlight = True
        Loop Until Selection.Range.HighlightColorIndex = wdYellow _
          Or Not .Found
    End With
End Sub

You can search for different colors simply by changing the wdYellow enumeration to the enumeration for whatever color you want.


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 (13552) 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. ...


Removing All Comments

Need to get rid of all the comments in your document? You can do so by using the regular Find and Replace feature of Word.

Discover More

Moving Master and Subdocuments

If you need to move master documents or subdocuments from one place to another on your computer, you have to keep in mind ...

Discover More

Copying Form Field Contents

Are you developing a form with Word? In some instances it is advantageous to copy whatever is entered in a form field to ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Removing HTTP from URLs

Having problems when it comes to replacing information in URLs? You're not the only one; it can be confusing making mass ...

Discover More

Using Search Text in the Replacement

When you use the Find and Replace tool in Word, you may want to include what you searched for in the replacement text. ...

Discover More

Changing the Formatting of All Instances of a Word

Need to find all the instances of a particular word and change the formatting of those instances? It's easy to do using ...

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 5 - 2?

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.

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.