VBA Cell Font – Change Bold, Italic or Underline

VBA Cell Font

Introduction/Problem Statement

Sometimes the user needs to highlight the font to show its importance. we change the VBA Cell Font of the text to bold, italic or underline to highlight text.

Solution

VBA Cell FontĀ  – Change to Bold

This code will change the font of Range A2 to Bold.

Change Font to Bold

Sub KDataScience_CellBold()
    
    'To change the font of range A2 to bold
    Worksheets("Sheet1").Range("A2").Font.Bold = True
    
End Sub

Change Font to Italic.

This code will change the font of range A4 to italic

Change Font to Italic

Sub KDataScience_CellItalic()
    
    'To change the font of range A4 to Italic
    Worksheets("Sheet1").Range("A4").Font.Italic = True
    
End Sub

Change Font to Underline.

This code will change the font of range A5 to underline.

Change Font to Underline

Sub KDataScience_CellUnderline()
    
    'To change the font of range A5 to underline
    Worksheets("Sheet1").Range("B5").Font.Underline = True
    
End Sub

Conclusion

In this blog, we have seen how to change the VBA Cell Font to bold, italic or underline using VBA in Excel. We can use the above code according to our needs.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *