DataBarBorder Object (Excel)
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

DataBarBorder Object (Excel)

Represents the border of the data bars specified by a conditional formatting rule.

Version Added: Excel 2010

Use the DataBarBorder object to get or set the color and border type for data bars. To access the DataBarBorder object associated with a data bar conditional formatting rule, use the BarBorder property. After retrieving the DataBarBorder object, use its Color property to return a FormatColor object that you can use to set the color of the data bars.

The following code example selects a range of cells, adds a data bar conditional formatting rule to that range, uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and then sets the data bar's color, tint, and type.

Set myDataBar = Selection.FormatConditions.AddDatabar 
With myDataBar.BarBorder 
 .Type = xlDataBarBorderSolid 
 .Color.ThemeColor = xlThemeColorAccent2 
 .Color.TintAndShade = 0 
End With 

© 2016 Microsoft