編輯

共用方式為


ColorScaleCriteria Interface

Definition

A collection of ColorScaleCriterion objects that represents all of the criteria for a color scale conditional format. Each criterion specifies the minimum, midpoint, or maximum threshold for the color scale.

public interface class ColorScaleCriteria : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("00024494-0000-0000-C000-000000000046")]
[System.Runtime.InteropServices.InterfaceType(2)]
public interface ColorScaleCriteria : System.Collections.IEnumerable
Public Interface ColorScaleCriteria
Implements IEnumerable
Attributes
Implements

Examples

The following code example creates a range of numbers and then applies a two-color scale conditional formatting rule to that range. The color for the minimum threshold is then assigned to red and the maximum threshold to blue by indexing into the ColorScaleCriteria collection to set individual criteria.

<span class="label">Sub CreateColorScaleCF()  































































































































































































































































































































































































































































































































    Dim cfColorScale As ColorScale  































































































































































































































































































































































































































































































































    'Fill cells with sample data from 1 to 10  































































































































































































































































    With ActiveSheet  































































































































































































































































        .Range("C1") = 1  































































































































































































































































        .Range("C2") = 2  































































































































































































































































        .Range("C1:C2").AutoFill Destination:=Range("C1:C10")  































































































































































































































































    End With  































































































































































































































































































































































































































































































































    Range("C1:C10").Select  































































































































































































































































































































































































































































































































    'Create a two-color ColorScale object for the created sample data range  































































































































































































































































    Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=2)  































































































































































































































































































































































































































































































































    'Set the minimum threshold to red and maximum threshold to blue  































































































































































































































































    cfColorScale.</span>
<i>ColorScaleCriteria(1)</i>
<span class="label">.FormatColor.Color = RGB(255, 0, 0)     cfColorScale.</span>
<i>ColorScaleCriteria(2)</i>
<span class="label">.FormatColor.Color = RGB(0, 0, 255)          End Sub </span>

Remarks

To return the ColorScaleCriteria collection, use the ColorScaleCriteria property of the ColorScale object.

Properties

_Default[Object]

Reserved for internal use.

Count

Returns an Integer value that specifies the number of criteria for a color scale conditional format rule. Read-only.

Item[Object]

Returns a single ColorScaleCriterion object from the ColorScaleCriteriacollection. Read-only.

Methods

GetEnumerator()

Applies to