How to Remove or Replace a Specific Highlight Color in Word
Question details
The user wants to remove or replace one specific highlight color in a Microsoft Word document without altering text highlighted in different colors.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Trying to selectively clear or change a particular highlight color (e.g., yellow) while leaving other highlight colors (e.g., green or blue) intact.
- Observed behavior
- Word's standard Find and Replace tool only searches for generic highlights and cannot differentiate between specific highlight colors.
Ensure your document is saved and that you have the Developer tab enabled in Word, as you will need to access the VBA editor to run the required macro.
Use a VBA Macro to Target and Remove a Specific Highlight Color
Since Word's built-in interface cannot isolate a specific highlight color, running a short VBA macro is the most effective way to selectively clear it.
This macro reads the highlight color of the text currently selected by your cursor, searches the entire document for that exact color, and removes the highlight automatically.
Place your text cursor directly on a word that has the specific highlight color you wish to remove from the document.
Press the Alt + F11 keys on your keyboard to open the Microsoft Visual Basic for Applications window.
Click on 'Insert' in the top menu bar, and select 'Module' from the dropdown list to open a blank code window.
Copy and paste the following code into the module window: Sub RemoveOneHighlight() Dim HLColor As WdColorIndex Dim rg As Range HLColor = Selection.Range.HighlightColorIndex If HLColor <> wdNoHighlight Then Set rg = ActiveDocument.Range With rg.Find .Highlight = HLColor .Wrap = wdFindStop While .Execute If rg.HighlightColorIndex = HLColor Then rg.HighlightColorIndex = wdNoHighlight rg.Collapse wdCollapseEnd Wend End With Else MsgBox "Place the cursor on text that has the highlight to remove." End If End Sub
Press F5 or click the green 'Run' button in the toolbar. The macro will execute, and the specific highlight color will be removed throughout the entire document.

Edit and Format Documents Easily with WPS Office
WPS Office offers a comprehensive, highly compatible, and free alternative to Microsoft Word. It provides advanced formatting tools, a familiar interface, and seamless support for your existing documents without the heavy subscription costs.
- 1. Download the software: Visit the official WPS website to download the free WPS Office suite for your operating system.
- 2. Install and launch: Follow the simple installation instructions and open the WPS Writer application.
- 3. Open your Word documents: Open your existing DOCX files directly in WPS Writer to continue editing and formatting without losing any data.

Frequently Asked Questions
Can I use the standard Find and Replace tool to remove a specific highlight color?
No, Microsoft Word's standard Find and Replace tool can only detect if text is highlighted or not. It cannot differentiate between specific highlight colors like yellow or green, which is why a VBA macro is required.
Will running this VBA macro affect other document formatting?
No, the provided macro specifically targets the HighlightColorIndex property. All other text formatting, including bold, italics, font size, or font color, will remain completely unaffected.
How do I save a document after running a macro in Word?
If you want to keep the macro for future use, you must save your document as a Word Macro-Enabled Document (*.docm). If you only needed to run it once and want to discard the code, simply save it as a standard Word Document (*.docx) and Word will automatically strip out the macro.




