Fix Excel Macro Failing to Delete Specific Font Color Text
Question details
A VBA macro designed to remove text of a specific font color fails to work on Excel cells that contain more than 255 characters.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Attempting to clean up spreadsheet data by automating the removal of specific colored text (e.g., red text) using an Excel VBA macro.
- Observed behavior
- The macro successfully deletes the targeted colored text in shorter cells, but encounters errors or completely ignores text formatting in cells exceeding the 255-character limit.
Check your target cells to ensure they contain static text rather than dynamic formulas, as copying data to a word processor and back will convert any underlying formulas into plain text.
Use Microsoft Word Find and Replace Workaround
Since Excel VBA has strict limitations on manipulating character-level formatting in long strings, using a word processor's advanced Find and Replace feature is the most reliable workaround.
Excel has an inherent system limitation when manipulating individual character formatting (such as font color, bold, or italic) in cells that contain more than 255 characters. Because of this, the VBA 'Characters' object often fails or behaves unpredictably on longer text strings. By leveraging Microsoft Word's advanced formatting search capabilities, you can easily bypass this Excel restriction.
Select the affected cells in your Excel spreadsheet that contain over 255 characters, and press Ctrl+C to copy the data.
Open a new blank document in Microsoft Word and press Ctrl+V to paste the copied Excel data.
In Word, press Ctrl+H to open the Find and Replace dialog box. Click on the 'More >>' button at the bottom left to reveal advanced search options.
Click inside the 'Find what' field and leave it blank. Click the 'Format' button at the bottom of the dialog, select 'Font', choose the specific font color you want to delete (e.g., Red), and click OK.
Click inside the 'Replace with' field and ensure it is completely empty. Click 'Replace All' to instantly remove all text matching that specific font color.
Press Ctrl+A to select the corrected text in Word, press Ctrl+C to copy it, and paste it back into your original cells in Excel using Ctrl+V.

Experience Seamless Text Manipulation with WPS Office
Frustrated by Excel's macro limitations and character caps? WPS Office provides a lightweight, all-in-one suite where you can seamlessly switch between Spreadsheets and Writer in a single window to perform advanced formatting tasks. Enjoy full compatibility with Microsoft Office formats without the hefty subscription fee.
- 1. Download and Install: Get the free WPS Office suite from the official website and install it on your computer.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your existing .xlsx files directly with zero compatibility issues.
- 3. Utilize WPS Writer: Use the integrated WPS Writer in a neighboring tab to quickly perform your formatting and Find/Replace workarounds seamlessly.

Frequently Asked Questions
Why does my Excel macro fail on cells with over 255 characters?
Excel's VBA 'Characters' object has a legacy limitation. When a single cell contains more than 255 characters, VBA cannot reliably read or modify the specific formatting (like font color, size, or styling) of individual characters within that string, resulting in macro errors or ignored commands.
Can I use VBA to bypass the 255-character formatting limit directly in Excel?
While there are highly complex VBA workarounds that involve splitting the text into smaller chunks, modifying the color, and piecing it back together, these scripts are prone to breaking and run very slowly. Using a Word document for formatting manipulation is universally recommended as the most efficient and practical solution.
Will pasting data back from Word to Excel mess up my spreadsheet layout?
As long as you copy and paste the text content directly back into the exact cells you copied them from, your overall spreadsheet layout and cell dimensions will remain unaffected. If you encounter styling issues, right-click the destination cell in Excel and choose 'Match Destination Formatting' under the Paste Options.




