Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns a Border object that represents one of the borders of a range of cells, a style, or a conditional format.
Syntax
expression.Item (Index)
expression A variable that represents a Borders object.
Parameters
| Name | Required/Optional | Data type | Description |
|---|---|---|---|
| Index | Required | XlBordersIndex | The border to return. The supported values depend on the object that returned the Borders collection. See the Remarks section. |
Remarks
The supported value of Index depends on the object that returned the Borders collection:
- For Range.Borders and Style.Borders, use the applicable XlBordersIndex constants, such as xlEdgeBottom.
- For FormatCondition.Borders, use xlLeft, xlRight, xlTop, or xlBottom. Don't use the corresponding xlEdge constants.
Example
This following example sets the color of the bottom border of cells A1:G1.
Worksheets("Sheet1").Range("a1:g1"). _
Borders.Item(xlEdgeBottom).Color = RGB(255, 0, 0)
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.