Borders Collection Object

Description

A collection of four Border objects representing the four borders of a Range or Style object.

Accessors

Use the Borders method with an argument to access a single member of the collection. The following example sets the bottom border of cells A1:G1 to a double line.


Worksheets("Sheet1").Range("a1:g1"). _
    Borders(xlBottom).LineStyle = xlDouble

Use the Borders method with no arguments to access all four borders at once. The following example puts a double blue border around cell C5:


With Worksheets("sheet1").Range("c5").Borders
    .LineStyle = xlDouble
    .Color = RGB(0, 0, 255)
End With

Remarks

You can set border properties for an individual border only with Range and Style objects. Other bordered objects, such as check boxes or chart areas, have a border that is treated as a single entity, regardless of how many sides it has. For these objects, you must access and set properties for the entire border at once. See the Border object for more information.

Properties

Application Property, Color Property, ColorIndex Property, Count Property, Creator Property, LineStyle Property, Parent Property, Value Property, Weight Property.

Methods

Item Method.