How to Control Partial Bold Formatting in Excel VBA
Question details
The user wants to understand why the Bold button remains active when only a portion of a cell is formatted as bold and how to cleanly manage partial bold formatting without it affecting newly entered text.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Using Excel VBA to apply bold formatting to specific characters or substrings within a cell.
- Observed behavior
- When the first character of a cell is made bold via VBA, Excel displays the Bold UI button as active. Consequently, any new text appended to the cell unexpectedly inherits the bold formatting.
Ensure you have the Developer tab enabled in your spreadsheet software and save a backup of your workbook before running or testing new VBA macros.
Reset Cell Font Before Applying Partial Bold via VBA
Prevent newly entered text from unexpectedly inheriting bold formatting by clearing the cell's global font style before targeting specific characters.
Excel’s user interface determines the active state of the Bold button based on the formatting of the very first character in a cell. If the first character is formatted as bold via VBA, Excel assumes the cell's active typing state is bold.
To bypass this inheritance issue, you must explicitly set the entire cell to a regular font weight before injecting the text, and only then apply the bold formatting to the desired subset of characters.
In your VBA script, set the target cell's font to regular using Range("A1").Font.Bold = False before adding or modifying the cell text.
Assign the desired text to the cell using Range("A1").Value = "Your Text Here".
Use the Characters object to format the specific substring. For example: Range("A1").Characters(Start:=1, Length:=4).Font.Bold = True.

Write and Execute VBA Macros Seamlessly in WPS Office
WPS Office provides robust support for VBA and macros, allowing you to automate repetitive tasks and format cell text precisely, offering an excellent alternative for your spreadsheet automation needs.
- 1. Enable Developer Tools: Open WPS Spreadsheet, go to the 'Options' menu, and ensure the Developer tab is enabled to access macro tools.
- 2. Open the VBA Editor: Click 'Visual Basic' in the Developer tab or press ALT + F11 to launch the macro editor.
- 3. Write your formatting script: Insert a new module and write your script using standard VBA commands to reset global cell formatting and apply partial bold attributes.

Frequently Asked Questions
Why does the Bold button stay highlighted when only one word is bold?
Excel determines the formatting state of the whole cell based on the first character. If the first character is bold, the Bold toolbar button appears active, even if subsequent text is regular.
Can I apply multiple font colors to a single cell using VBA?
Yes. Similar to the bold property, you can use the Characters(Start, Length).Font.Color property in VBA to apply different colors to specific text segments within a single cell.
How do I remove bold formatting from an entire cell in VBA?
You can easily remove bold formatting by targeting the cell or range and setting the bold property to false: Range("A1").Font.Bold = False.




