Class NegativeBarFormat (Excel VBA)

The class NegativeBarFormat represents the color settings of the data bars for negative values that are defined by a data bar conditional formating rule. To use a NegativeBarFormat class variable it first needs to be instantiated, for example


Dim nbf as NegativeBarFormat
Set nbf = ActiveCell.FormatConditions(1).NegativeBarFormat

BorderColor

Returns a FormatColor formatcolor that you can use to specify the border color for negative data bars. Read-only.


Dim fcrBorderColor As FormatColor
Set fcrBorderColor = ActiveCell.FormatConditions(1).NegativeBarFormat.BorderColor

BorderColorType

Specifies whether to use the same border color as positive data bars. Possible return values are xlDataBarColor - Use the color specified in the Negative Value and Axis Setting dialog box or by using the ColorType and BorderColorType properties of the NegativeBarFormat object, xlDataBarSameAsPositive - Use the same color as positive data bars.

If you set the BorderColorType property to xlDataBarColor, use the BorderColor property to return a FormatColor object that you can use to specify the border color.


ActiveCell.FormatConditions(1).NegativeBarFormat.BorderColorType = xlDataBarColor

Color

Returns a FormatColor formatcolor that you can use to specify the fill color for negative data bars. Read-only.


Dim fcrColor As FormatColor
Set fcrColor = ActiveCell.FormatConditions(1).NegativeBarFormat.Color

ColorType

Specifies whether to use the same fill color as positive data bars. Possible return values are xlDataBarColor - Use the color specified in the Negative Value and Axis Setting dialog box or by using the ColorType and BorderColorType properties of the NegativeBarFormat object, xlDataBarSameAsPositive - Use the same color as positive data bars.

If you set the ColorType property to xlDataBarColor, use the Color property to return a FormatColor object that you can use to specify the fill color.


ActiveCell.FormatConditions(1).NegativeBarFormat.ColorType = xlDataBarColor