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 Italics within a Macro.
Written by Allen Wyatt (last updated April 3, 2021)
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 an italics typeface so that they stand out. You do this by setting the Italic property of the Font object for a selection.
For instance, if you wanted to make the contents of cell A1 italics, you could use the following in your macro:
Cells(1, 1).Font.Italic = True
Likewise, if you wanted to make the currently selected cell italics, you could use the following code:
Selection.Font.Italic = True
If you wanted to explicitly turn off the italics 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 (9307) 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 Italics within a Macro.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
When you open multiple workbooks, the way in which Excel sizes them is not the best for your needs. This tip looks at a ...
Discover MoreYou might want to display a value in a cell as an upward-counting value. This might seem difficult but can be done rather ...
Discover MoreVBA provides a few different ways you can search for information within strings. This tip looks at the most efficient ...
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