ColorIndex Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

ColorIndex property as it applies to the Border object. 

Returns or sets the color of the border. The color is specified as an index value into the current color palette, or as a XlColorIndex constant**.** Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

 

expression.ColorIndex

expression   Required. An expression that returns a Border object.

ColorIndex property as it applies to the Borders object. 

XlColorIndex

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Borders object.

ColorIndex property as it applies to the Font object. 

Returns or sets the color of the font. The color is specified as an index value into the current color palette, or as XlColorIndex constant**.** Read/write Variant.

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Font object.

ColorIndex property as it applies to the Interior object. 

XlColorIndex

XlColorIndex can be one of these XlColorIndex constants.
xlColorIndexAutomatic
xlColorIndexNone

expression.ColorIndex

expression   Required. An expression that returns a Interior object.

Remarks

This property specifies a color as an index into the workbook color palette. You can use the Colors method to return the current color palette.

The following illustration shows the color-index values in the default color palette.

Color index values in default color palette

Example

As it applies to the Font object.

This example changes the font color in cell A1 on Sheet1 to red.

  Spreadsheet1.ActiveSheet.Range("A1").Font.ColorIndex = 3