Complete the code to apply a 3-color scale conditional formatting in Excel.
Range("A1:A10").FormatConditions.AddColorScale([1])
Excel uses 3 for a 3-color scale in conditional formatting.
Complete the code to set the minimum color to red in a 3-color scale.
With Range("B1:B10").FormatConditions(1).ColorScaleCriteria(1) .Type = xlConditionValueLowestValue .FormatColor.Color = [1] End With
Red color in RGB is (255, 0, 0), which sets the minimum color to red.
Fix the error in setting the midpoint color to yellow in a 3-color scale.
With Range("C1:C10").FormatConditions(1).ColorScaleCriteria(2) .Type = xlConditionValuePercentile .Value = 50 .FormatColor.Color = [1] End With
Yellow color is RGB(255, 255, 0), which is correct for midpoint color.
Fill both blanks to set the maximum color to green and the type to highest value.
With Range("D1:D10").FormatConditions(1).ColorScaleCriteria([1]) .Type = [2] .FormatColor.Color = RGB(0, 255, 0) End With
The maximum color is the third color in the scale, so index 3. The type for maximum is xlConditionValueHighestValue.
Fill all three blanks to create a 3-color scale with red minimum, yellow midpoint, and green maximum colors.
With Range("E1:E10").FormatConditions.AddColorScale([1]) With .ColorScaleCriteria([2]) .Type = xlConditionValueLowestValue .FormatColor.Color = RGB(255, 0, 0) End With With .ColorScaleCriteria([3]) .Type = xlConditionValuePercentile .Value = 50 .FormatColor.Color = RGB(255, 255, 0) End With
Use 3 for the number of colors. The minimum color is index 1, midpoint is index 2.