Skip to main content

Border.ColorIndex property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

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



expression A variable that represents a Border object.


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


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

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>