ColorIndex Property

Applies To

Border object, Font object, Interior object.

Description

Returns or sets the color of the border 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.

Object

Description

Border

The color of the border.

Interior

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).


Remarks

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

Color

Index value

Aqua

8, 28, 33, 34, 42

Black

1, 51, 52

Blue

5, 32, 41, 49

Fuchsia

7, 26

Gray

16, 46, 47, 48, 56

Green

10, 43

Lime

4

Maroon

9, 30, 53

Navy

11, 25, 55

Olive

12, 44, 45

Purple

13, 18, 21, 29, 54

Red

3

Silver

15, 17, 20, 22, 24, 35, 36, 37, 38, 39

Teal

14, 23, 31, 50

White

2, 19, 40

Yellow

6, 27


See Also

Color property, PatternColor property.

Example

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
        .MajorGridlines.Border.ColorIndex = 5   ' Set color to blue.
    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