Range.BorderAround (Excel)

Adds a border to a range and sets the Color, LineStyle, and Weight properties of the Border border for the new border. Variant.

You must specify only one of the following: ColorIndex, Color, or ThemeColor. You can specify either LineStyle or Weight, but not both. If you don't specify either argument, Microsoft Excel uses the default line style and weight. This method outlines the entire range without filling it in. To set the borders of all the cells, you must set the Color, LineStyle, and Weight properties for the Borders collection. To clear the border, you must set the LineStyle property to xlLineStyleNone for all the cells in the range.

BorderAround (LineStyle, Weight, ColorIndex, Color, ThemeColor)


Dim brdBorderAround As Border
Set brdBorderAround = ActiveCell.BorderAround()

Arguments

Optional arguments

The following arguments are optional

LineStyle (XlLineStyle) - One of the constants of XlLineStyle specifying the line style for the border.


Possible values are

xlContinuous Continuous line.
xlDash Dashed line.
xlDashDot Alternating dashes and dots.
xlDashDotDot Dash followed by two dots.
xlDot Dotted line.
xlDouble Double line.
xlLineStyleNone No line.
xlSlantDashDot Slanted dashes.

Weight (XlBorderWeight) - The border weight.


Possible values are

xlHairline Hairline (thinnest border).
xlMedium Medium.
xlThick Thick (widest border).
xlThin Thin.

ColorIndex (XlColorIndex) - The border color, as an index into the current color palette or as an XlColorIndex constant.

Possible return values are xlColorIndexAutomatic - Automatic color, xlColorIndexNone - No color.

Color (Long) - The border color, as an RGB value.

ThemeColor (XlThemeColor) - The theme color, as an index into the current color theme or as an XlThemeColor value.

Here you can find possible values for XlThemeColor