Tricolor color scale with VBA in Microsoft Excel

The AddColorScale () method is called with the value 3 for the Type parameter. The change also changes the color for the xlConditionValuePercentile collection element. The percentile is a specific mean value from statistics.

Sub DreiFarbenSkala()
Dim rg As Range
ThisWorkbook.Worksheets("Tabelle6").Activate
Set rg = Range("A2:A11")
rg.FormatConditions.Delete
' DreiFarbenSkala erzeugen
rg.FormatConditions.AddColorScale 3
' DreiFarbenSkala ändern
With rg.FormatConditions(1)
.ColorScaleCriteria(1).Type = _
xlConditionValueLowestValue
.ColorScaleCriteria(1).FormatColor.Color = _
vbGreen
.ColorScaleCriteria(2).Type = _
xlConditionValuePercentile
.ColorScaleCriteria(2).FormatColor.Color = _
vbYellow
.ColorScaleCriteria(3).Type = _
xlConditionValueHighestValue
.ColorScaleCriteria(3).FormatColor.Color = _
vbRed
End With
End Sub

Was the explanation to "Tricolor color scale with VBA in Microsoft Excel"Helpful? Rate now:

Weitere Erklärungen zu Skriptsprachen