You make text bold in VBA by setting the Font.Bold property of a cell or range to True. The shortest working version is Range("A1").Font.Bold = True. That single line bolds whatever is in cell A1 while leaving the text, the formula and the formatting of every other cell untouched. You can run it from the Visual Basic Editor, from the Immediate window, from a recorded macro or from a button on the sheet. The rest of this guide covers the range of real situations you will meet: bolding part of a string, formatting whole rows or columns, using variables, and building a loop that finds rows instead of hard-coding addresses.
What You'll Need
- A desktop copy of Excel with macros enabled. VBA does not run in Excel for the web, and the mobile apps cannot edit macros, so the Macro dialog and the Visual Basic Editor are desktop-only.
- The Developer tab visible, or access to the Visual Basic Editor through the shortcut Alt+F11 (on a Mac, use the Tools menu or the equivalent developer option, since modifier keys differ by keyboard layout).
- A workbook saved as an .xlsm file if you want the code to survive closing. A plain .xlsx workbook drops the macro on save, even if you never see an error before you close it.
- A test sheet to work on. Never point new formatting code at a live report first; run it on a copy so a wrong range does not change anything you cannot get back with Ctrl+Z (and VBA formatting changes often cannot be undone once the macro ends).
Step-by-Step
- Open the editor. Press Alt+F11 in Excel for Windows. The Visual Basic Editor opens in its own window. If nothing happens, turn on the Developer tab first: right-click the ribbon, choose Customize the Ribbon, tick the Developer checkbox on the right-hand list, then use the Visual Basic button. Menu labels can differ slightly by version, device and region, so look for the wording closest to this rather than an exact match.
- Insert a module. In the editor, use Insert > Module. A blank code window appears. Modules are where general-purpose macros live; you do not need one for every line, but you do need one before you can paste code. Do not paste into the ThisWorkbook or a sheet module unless you intend the code to react to an event such as opening the file or changing a cell.
- Write the simplest macro. Type the following into the module window:
TheSub MakeBold() Range("A1").Font.Bold = True End SubSubandEnd Sublines mark the start and end of the macro. The middle line is the whole action. - Run it. Click anywhere inside the three lines of code, then press F5, or use Run > Run Sub/UserForm. Switch back to Excel with Alt+F11. Cell A1 on the active sheet should now be bold. If A1 was empty, type something into it and the text will appear bold, because formatting applies to the cell whether or not it holds text.
- Bold a whole range. Change the line to
Range("A1:C10").Font.Bold = Trueto bold a block, or useRange("A:A").Font.Bold = Truefor an entire column andRows(3).Font.Bold = Truefor a whole row. The colon means "from one corner to the other" and the reference is always top-left to bottom-right. - Point at the right sheet. A bare
Rangerefers to whichever sheet is active, which makes the macro fragile. Qualify it plainly:Worksheets("Report").Range("A1").Font.Bold = True. This works even if the user is looking at a different tab when the macro runs. - Bold only part of a cell's text. This needs the
Charactersobject, which cannot be used on an empty cell and does not accept a whole-cell style shortcut:With Range("A1") .Characters(Start:=1, Length:=5).Font.Bold = True End WithStartcounts characters from the left;Lengthis how many to bold. To bold the first word only, wrap the line in a loop or calculate the length withInStr. - Use a variable for the address. Reading the address into a variable lets the same code work on whichever cell is selected:
Set target = Selectionthentarget.Font.Bold = True. DeclaringDim target As Rangeat the top avoids the common "Object required" error when the variable has not been set. - Toggle instead of always setting. If you want a macro that flips bold on and off, use
Range("A1").Font.Bold = Not Range("A1").Font.Bold. Running it twice returns the cell to normal. This is handy on a keyboard shortcut or a shape button. - Loop through rows. To bold every row where column A says "Total", loop with a variable:
Stop the loop at the last used row (for exampleDim r As Long For r = 2 To 1000 If Cells(r, 1).Value = "Total" Then Cells(r, 1).EntireRow.Font.Bold = True End If Next rCells(Rows.Count, 1).End(xlUp).Row) rather than a guessed number so it does not process blank rows forever on a large sheet. - Save as a macro-enabled file. Use File > Save As and pick the macro-enabled workbook format (.xlsm). Close and reopen the file to confirm the macro is still listed under Developer > Macros. If Excel shows a security bar about blocked content, use the option to enable content for that file only when you are sure where it came from.
Common Mistakes
- Setting
Bold = "True"in quotes. Quotes make it text, and VBA throws a type mismatch. The value must be the keywordTrueorFalsewithout quotes. - Forgetting the sheet qualifier. A macro that works on your screen can bold the wrong tab when someone else runs it while another sheet is active. Name the worksheet explicitly.
- Using
Characterson an empty cell. Partial formatting exists only where there is text to format, so it raises an error on a blank cell. Check the cell has a value first. - Confusing
Cells(1, 2)withRange("B1"). Both point at B1, butCellstakes row then column, and swapping them silently bolds the wrong cell instead of erroring. - Expecting font changes to survive
ClearFormats. If later code or a paste operation clears formats, bold is erased along with colours and borders. Apply formatting after any clearing step, not before. - Assuming a
Font.Boldvalue can be read back as strictly True or False. A cell whose text is only partly bold returnsNullrather than a plain False, which breaksIf ... Thentests unless you handle it. - Saving as .xlsx. Excel warns you about losing the macro but many people click through it, then wonder why the code is gone.
Tips
- Turn on Option Explicit at the top of the module. It forces you to declare variables and catches typos in names before they cause confusing runtime errors.
- Record a macro while manually bolding a cell, then read the recorded line. It is the quickest way to discover the exact property syntax for whatever you are trying to do.
- Reuse one
Withblock for several properties so you only resolve the range once:With Range("A1").Font .Bold = True .Size = 12 End With. - Attach the macro to a shape or a button (right-click, Assign Macro) so users can bold without touching the editor.
- Comment your macro with a line beginning with an apostrophe to note which sheet and range it expects. Future you will thank you.
Troubleshooting
If pressing F5 does nothing, the cursor is probably not inside the procedure. Click between Sub and End Sub and try again. If the macro runs but no cell changes, check you are looking at the sheet the code names, and that the workbook is not protected: protected sheets reject formatting changes silently or with a run-time error, so unprotect the sheet or add ActiveSheet.Unprotect before the formatting line and re-protect afterwards. A "Subscript out of range" error means the worksheet name in quotes does not exist, including a stray trailing space in the tab name, so check the exact tab text.
If the code halts with a compile error on a line that looks fine, look for a mistyped object name, a missing Set before assigning a range variable, or a mismatched If/End If. If macros will not run at all, the file may be in a trusted-location or security setting that blocks them; use the Trust Center settings in the desktop app rather than lowering security globally. And if the macro worked yesterday and not today, confirm the file was saved in the macro-enabled format and reopened from a local folder rather than a temporary download location.
Frequently Asked Questions
Can VBA bold text without changing the font size or colour?
Yes. Font.Bold changes only the weight. Size, colour, font family and fill stay exactly as they were.
How do I bold text in a text box or shape rather than a cell?
Point at the shape's text range, for example ActiveSheet.Shapes("TextBox 1").TextFrame.Characters.Font.Bold = True. The object hierarchy differs from a cell range, so do not copy cell syntax directly.
Does Font.Bold work with conditional formatting?
Not directly. Conditional formatting is set through the FormatConditions object, where bold is enabled with .Font.Bold = True inside the condition's format. A plain run of the macro will not persist on cells it does not reach.
Why does part of my cell return an error when I check whether it is bold?
Once a cell contains mixed formatting, its bold property is indeterminate and reads as Null. Test IsNull before comparing, or check individual characters instead.
Can I bold a whole row based on a value without writing a loop?
Not in VBA without iterating or filtering. The practical approach is AutoFilter for the value and then formatting the visible range, or a short loop as shown above.