Sub Add3ColorScale()
With Range("A1:A10")
.FormatConditions.Delete
' Add the Color Scale as a 3-color scale
.FormatConditions.AddColorScale ColorScaleType:=3
' Format the first color as light red
.FormatConditions(1).ColorScaleCriteria(1).Type = xlConditionValuePercent
.FormatConditions(1).ColorScaleCriteria(1).Value = 3
.FormatConditions(1).ColorScaleCriteria(1).FormatColor.Color = RGB(255, 0, 0)
.FormatConditions(1).ColorScaleCriteria(1).FormatColor.TintAndShade = 0.25
' Format the second color as green at 50%
.FormatConditions(1).ColorScaleCriteria(2).Type = xlConditionValuePercent
.FormatConditions(1).ColorScaleCriteria(2).Value = 5
.FormatConditions(1).ColorScaleCriteria(2).FormatColor.Color = RGB(0, 255, 0)
.FormatConditions(1).ColorScaleCriteria(2).FormatColor.TintAndShade = 0
' Format the third color as dark blue
.FormatConditions(1).ColorScaleCriteria(3).Type = xlConditionValuePercent
.FormatConditions(1).ColorScaleCriteria(3).Value = 8
.FormatConditions(1).ColorScaleCriteria(3).FormatColor.Color = RGB(0, 0, 255)
.FormatConditions(1).ColorScaleCriteria(3).FormatColor.TintAndShade = -0.25
End With
End Sub
|