Returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value. Read/write Variant.
Syntax
expression.Color
expression An expression that returns a Font object.
Remarks
Object | Color |
---|---|
Border | The color of the border. |
Borders | The color of all four borders of a range. If they're not all the same color, Color returns 0 (zero). |
Font | The color of the font. |
Interior | The cell shading color or the drawing object fill color. |
Tab | The color of the tab. |
Example
This example sets the color of the tick-mark labels on the value axis on Chart1.
Charts("Chart1").Axes(xlValue).TickLabels.Font.Color = RGB(0, 255, 0)
The following code sets the font color of cell A1 to vbBlack (Black).
Range("A1").Font.Color = vbBlack
The following code sets the font color of cell A1 to 0 (Black).
Range("A1").Font.Color = 0
The following code sets the font color of cell A1 to RGB(0, 0, 0) (Black).
Range("A1").Font.Color = RGB(0, 0, 0)
The following code use XlRgbColor sets the font color of cell A1 to rgbBlue (Blue).
Range("A1").Font.Color = rgbBlue