top of page

#NiftyKeyboardShortcuts: Formatting Fundamentals 1: Bold (CTRL + B), Italic (CTRL + I) and Underline

  • Mark Jenner
  • Jul 11, 2017
  • 2 min read

The universal donors of the keyboard shortcuts are those to make text bold, italic or underlined: applicable in almost any application or environment, not just in Excel, but across Office, in your web-based email, Wix and lots of other places.


Having said that, there is not a lot more to say apart from CTRL + B, CTRL + I and CTRL + U are what you need to use - another example of shortcuts that are easy to remember as long as you know your alphabet.


You don't even need to have entered any text and then selected it: these commands are turned on once you use the shortcut, and proceed to display your entries with the formatting settings you have applied.


These are toggle commands, and so using the shortcut again removes the format: so if it was on, it turns it off, as well as vice versa.


If this shortcut is applied on data where, for example, some Excel cells are already bold and others are in regular type, the default behaviour is to remove the formatting from all cells first, before applying it to them all if the shortcut is repeated.


And note also the difference between underlining and bordering:

Keyboard formatting options

Underlining affects the text itself; bordering is applied to the Excel cell - and this simple graphic gives you the shortcut for bottom-bordering (Alt + H + B + O) as a little extra...!


Converting text to bold, italic or underline via VBA is not necessarily a frequent action, but it's good to know the theory, especially that these formats are properties of the Font object:

VBA code to format font

Setting bold, italic or underline to True (or False) it what shows that these properties are Boolean variables, i.e. either on or off.


Executing this code would always end up with selected cells being bold, italic and underlined. To get code that acts in the same way as the ribbon commands (i.e. toggling on and off), you could declare a Boolean variable and use an If test - for example, to toggle bold:


Toggling the bold property with VBA

This code determines whether the selection is already bold, assigns the value False to the variable Test if so (and True if not), such that the With-End With structure always changes the formatting of the selection to the opposite of what it was when the macro began executing.

Comments


Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

© 2016 Excel Help Bedford

  • w-facebook
bottom of page