Muokkaa

Jaa


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 or xlColorIndexNone.

Important

Note that the visual properties of a Border object are interlocked; that is, changing one property can induce changes in another. In most cases, the induced changes serve to make the border visible (which may or may not be desirable). However, other (more unexpected) results are possible. For an example, see the Border object.

Example

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

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.