ColorIndex Property
Collapse the table of content
Expand the table of content

ColorIndex Property

Office 2010

Returns or sets the color of the border, font or interior, as shown in the following table. The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Variant.




The color of the border.


The color of the font.


The color of the interior fill. Set ColorIndex to xlColorIndexNone to specify that you don't want an interior fill. Set ColorIndex to xlColorIndexAutomatic to specify the automatic fill (for drawing objects).


expression Required. An expression that returns one of the objects in the Applies To list.

This property specifies a color as an index into the color palette. The following illustration shows the color-index values in the default color palette.


The following examples assume that you're using the default color palette.

This example sets the color of the major gridlines for the value axis.

With myChart.Axes(xlValue) 
 If .HasMajorGridlines Then 
 'Set color to blue 
 .MajorGridlines.Border.ColorIndex = 5 
 End If 
End With

This example sets the color of the chart area interior to red and sets the border color to blue.

With myChart.ChartArea 
 .Interior.ColorIndex = 3 
 .Border.ColorIndex = 5 
End With
© 2015 Microsoft