Skip to main content

Borders.ColorIndex property

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

Returns or sets a Variant value that represents the color of all four borders.



expression A variable that represents a Borders object.


This property returns Null if all four borders aren't the same color.

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


The following example sets the borders color of the range B2:E5 to xlColorIndexAutomatic (Automatic color).

ActiveSheet.Range("B2:E5").Borders.ColorIndex = xlColorIndexAutomatic

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>