Borders Property
TOC
Collapse the table of content
Expand the table of content

Range.Borders Property (Excel)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a Borders collection that represents the borders of a style or a range of cells (including a range defined as part of a conditional format).

expression .Borders

expression A variable that represents a Range object.

This example sets the color of the bottom border of cell B2 on Sheet1 to a thin red border.

Sub SetRangeBorder() 
 
 With Worksheets("Sheet1").Range("B2").Borders(xlEdgeBottom) 
 .LineStyle = xlContinuous 
 .Weight = xlThin 
 .ColorIndex = 3 
 End With 
 
End Sub

Concepts

Other resources

Show:
© 2016 Microsoft