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.

Item

To use a FormatColor class variable it first needs to be instantiated, for example

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

The following procedures can be used to set variables of type FormatColor: ColorScaleCriterion.FormatColor, Databar.AxisColor, Databar.BarColor, DataBarBorder.Color, NegativeBarFormat.BorderColor, NegativeBarFormat.Color, SparkColor.Color and SparklineGroup.SeriesColor.

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.

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.

xlThemeColorAccent1 - Accent1, xlThemeColorAccent2 - Accent2, xlThemeColorAccent3 - Accent3, xlThemeColorAccent4 - Accent4, xlThemeColorAccent5 - Accent5, xlThemeColorAccent6 - Accent6, xlThemeColorDark1 - Dark1, xlThemeColorDark2 - Dark2, xlThemeColorFollowedHyperlink - Followed hyperlink, xlThemeColorHyperlink - Hyperlink, xlThemeColorLight1 - Light1, xlThemeColorLight2 - Light2.
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 =