- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming»
- Programming Languages
VBA: How to Change Cell Font, Italicize, Bold, and Underline in Excel
Changing Font within Excel
Changing the font from within Excel is a very easy task:
- Select the Cell you would like to change font for
- Click the home tab
- Click the dropdown button next to the font box
- Select the desired font
Changing Font Size from within Excel
A very similar task is used to change the font size:
- Select the Cell you would like to change size of
- Click the home tab
- Click the dropdown button next to the font size box
- Select the desired size
Bolding a Font From within Excel
To Bold a font select a cell or range of cell and click the bold button on the home tab or press control+B
To Unbold a font select the cell or range of cells and click the bold button again or press control+B
Italicizing a Font From Excel
To Italicize a font click the Italics button of the Home Tab or press Control+I
To unItalicize a font click the Italics button again or press Control+I
Underlining a Font from Excel
To Underline a font click the Underline button on the Home Tab or press Control+U
To Ununderline a font click the Unerline button again or press Control+U
To Double Underline click the drop down box next to the underline button
Changing Font from VBA
You can change the also change the font of a cell or range of cells from within VBA
'Change font of Cell "J7" to Arial Black
Range("J7").Font.Name = "Arial Black"
Changing Font Size from VBA
'Change font size of Cell "J7" to 72 point
Range("J7").Font.Size=72
Bolding a Font From VBA
'Bold Cells "J7"
Range("J7").Font.Bold = True
'Unbold Cells "J7"
Range("J7").Font.Bold = False
Italicizing a Font from VBA
'Italicize Cells "J7"
Range("J7").Font.Italic = True
'Unitalicize Cells "J7"
Range("J7").Font.Italic = False
Underlining a Font in VBA
'Underline Cells "J7"
Range("J7").Font.Underline=True
'Ununderline Cells "J7"
Range("J7").Font.Underline=False
'Double Underline Cells "J7"
Range("J7").Font.Underline = xlUnderlineStyleDouble
Ready to Proceed?
In the next module we will build on our knowledge and learn to change the color of a font and set the background color of a cell. Click here when you are ready to proceed.