Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Making a Cell's Contents Bold within a Macro.
Written by Allen Wyatt (last updated January 18, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
If you are writing macros using VBA, it is not uncommon to process data and place the results of your processing into cells in a worksheet. If desired, you can also make the results in a bold typeface so that they stand out. You do this by setting the Bold property of the Font object for a selection.
For instance, if you wanted to make the contents of cell A1 bold, you could use the following in your macro:
Cells(1, 1).Font.Bold = True
Likewise, if you wanted to make the currently selected cell bold, you could use the following code:
Selection.Font.Bold = True
If you wanted to explicitly turn off the bold attribute of a particular cell, all you need to do is change True to False in the foregoing examples.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8775) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Making a Cell's Contents Bold within a Macro.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
If you work with geographic data, you may need a way to display latitude and longitude in a worksheet. This tip examines ...
Discover MoreIt is often desired to change what is displayed in a cell based on what is in a different cell. What if what you want to ...
Discover MoreIf you have a range of numeric values in your worksheet, you may want to change them from numbers to text values. Here's ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments