Class FormatColor (Excel VBA)

The class FormatColor represents the fill color specified for a threshold of a color scale conditional format or the color of the bar in a data bar conditional format. To use a FormatColor class variable it first needs to be instantiated, for example


Dim fcr as FormatColor
Set fcr = ActiveCell.FormatConditions(1).AxisColor

Color

Returns or sets the fill color associated with a threshold for a data bar or color scale conditional formatting rule.

The format color is expressed as an RGB function. For example, to set the color to red, use RGB(255,0,0).


ActiveCell.FormatConditions(1).AxisColor.Color = RGB(0,0,255)'blue

ColorIndex

Returns or sets one of the constants of the XlColorIndex enumeration, specifying if the fill color is expressed as an index value into the current color palette. Possible return values are xlColorIndexAutomatic - Automatic color, xlColorIndexNone - No color.

This property is used for each threshold of a color scale or data bar conditional formatting rule.


ActiveCell.FormatConditions(1).AxisColor.ColorIndex = xlColorIndexAutomatic

ThemeColor

Returns or sets one of the constants of the XlThemeColor enumeration, specifying the theme color used in a threshold of a data bar or color scale conditional format. Here you can find possible values for XlThemeColor.


ActiveCell.FormatConditions(1).AxisColor.ThemeColor = xlThemeColorAccent1

TintAndShade

Returns or sets a Single that lightens or darkens the fill color of a cell for a threshold of a data bar or color scale conditional formatting rule.

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property. Zero (0) is neutral.


ActiveCell.FormatConditions(1).AxisColor.TintAndShade =