Color Property
Collapse the table of content
Expand the table of content

DataBarBorder.Color Property (Excel)

Office 2013 and later

Contribute to this content

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

Returns an object that specifies the color of the border of data bars specified by a conditional formatting rule. Read-only

expression .Color

expression A variable that represents a DataBarBorder object.

Return Value

The following code example selects a range of cells and adds a data bar conditional formatting rule to that range. It then uses the BarBorder property to retrieve the DataBarBorder object associated with that rule, and uses the Color property of that object to retrieve the FormatColor object to set the color and tint of the data bar borders.

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

© 2016 Microsoft