Wednesday 22 May 2013

Macro to change the font color and size of Cell in Excel

Example -

Below example will change the font size as well as font color of text inside the cell in worksheet in Excel Workbook.

Code and Syntax

    Activeworksheet.Range("A1").select

    Selection.Font.Italic = True              'make the font italic in macro
    Selection.Font.Bold = False              'make the font bold in macro

    Selection.Font.Underline = xlUnderlineStyleSingle         'Underline the macro
    Selection.Font.ThemeColor = xlThemeColorLight2          ' Change the color of cell
    Selection.Font.TintAndShade = 0.399975585192419      'Change the shade of color

            Selection.Font.Name = "Calibri"                             'Change the name of font
            Selection.Font.Size = 20                                        'Change the size of macro
            Selection.Font.Strikethrough = False                      'Other features of font like strikethrough
            Selection.Font.Superscript = False                         'Subscript, Shadow, Underline etc.
            Selection.Font.Subscript = False
            Selection.Font.OutlineFont = False
            Selection.Font.Shadow = False
            Selection.Font.Underline = xlUnderlineStyleSingle

  Selection.Font.Color = -16776961
  Selection.Font.TintAndShade = 0
This is how we can change the Name , Size of font of Cell in excel. We can also change the color of font.


 

No comments:

Post a Comment

Popular Posts

Search This Blog