VBA & Macro Problems

How to Control Partial Bold Formatting in Excel VBA

Ayan MasoodAyan Masood Nov 11, 2026 869 views

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.

How to Control Partial Bold Formatting in Excel VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Clear existing bold formatting

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.

2
Insert the text string

Assign the desired text to the cell using Range("A1").Value = "Your Text Here".

3
Apply bold to specific characters

Use the Characters object to format the specific substring. For example: Range("A1").Characters(Start:=1, Length:=4).Font.Bold = True.

Reset Cell Font Before Applying Partial Bold via VBA
Manual vs. VBA Formatting Differences: Applying partial bold manually by highlighting text inside the formula bar behaves differently in the backend than assigning it via VBA's Characters object. VBA strictly follows the programmatic sequence you provide.
Advanced Spreadsheet Editor

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. 1. Enable Developer Tools: Open WPS Spreadsheet, go to the 'Options' menu, and ensure the Developer tab is enabled to access macro tools.
  2. 2. Open the VBA Editor: Click 'Visual Basic' in the Developer tab or press ALT + F11 to launch the macro editor.
  3. 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.
Fully compatible with Microsoft Excel VBA syntax, macro scripts, and formatting objects.Easily apply partial text formatting using standard VBA Characters objects.Lightweight, fast, and free to download.Familiar user interface requires no learning curve for Excel users.
microsoft office alternative - wps office

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.