Share via


Border.ColorIndex Property (Excel)

Returns or sets a Variant value that represents the color of the border.

Syntax

expression .ColorIndex

expression A variable that represents a Border object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

Example

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

With Charts("Chart1").Axes(xlValue) 
 If .HasMajorGridlines Then 
 .MajorGridlines.Border.ColorIndex = 5 'set color to blue 
 End If 
End With

See Also

Concepts

Border Object

Border Object Members