編輯

共用方式為


IconSet Interface

Definition

Represents a single set of icons that are used in an icon set conditional formatting rule.

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

Examples

The following code example creates a range of numbers representing test scores and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a 5-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

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































































































































































































































































































































































































































































































































    Dim cfIconSet As IconSetCondition  































































































































































































































































































































































































































































































































    'Fill cells with sample data from 1 to 10  































































































































































































































































    With ActiveSheet  































































































































































































































































        .Range("C1") = 55  































































































































































































































































        .Range("C2") = 92  































































































































































































































































        .Range("C3") = 88  































































































































































































































































        .Range("C4") = 77  































































































































































































































































        .Range("C5") = 66  































































































































































































































































        .Range("C6") = 93  































































































































































































































































        .Range("C7") = 76  































































































































































































































































        .Range("C8") = 80  































































































































































































































































        .Range("C9") = 79  































































































































































































































































        .Range("C10") = 83  































































































































































































































































        .Range("C11") = 66  































































































































































































































































        .Range("C12") = 74  































































































































































































































































    End With  































































































































































































































































































































































































































































































































    Range("C1:C12").Select  































































































































































































































































































































































































































































































































    'Create an icon set conditional format for the created sample data range  































































































































































































































































    Set cfIconSet = Selection.FormatConditions.AddIconSetCondition  































































































































































































































































































































































































































































































































    'Change the icon set to a 5-arrow icon set  































































































































































































































































    cfIconSet.IconSet = ActiveWorkbook.IconSets(xl5Arrows)  































































































































































































































































































































































































































































































































    'The IconCriterion collection contains all of IconCriteria  































































































































































































































































    'By indexing into the collection you can modify each criteria  































































































































































































































































































































































































































































































































    With cfIconSet.IconCriteria(1)  































































































































































































































































        .Type = xlConditionValueNumber  































































































































































































































































        .Value = 0  































































































































































































































































        .Operator = 7  































































































































































































































































    End With  































































































































































































































































    With cfIconSet.IconCriteria(2)  































































































































































































































































        .Type = xlConditionValueNumber  































































































































































































































































        .Value = 60  































































































































































































































































        .Operator = 7  































































































































































































































































    End With  































































































































































































































































    With cfIconSet.IconCriteria(3)  































































































































































































































































        .Type = xlConditionValueNumber  































































































































































































































































        .Value = 70  































































































































































































































































        .Operator = 7  































































































































































































































































    End With  































































































































































































































































    With cfIconSet.IconCriteria(4)  































































































































































































































































        .Type = xlConditionValueNumber  































































































































































































































































        .Value = 80  































































































































































































































































        .Operator = 7  































































































































































































































































    End With  































































































































































































































































    With cfIconSet.IconCriteria(5)  































































































































































































































































        .Type = xlConditionValueNumber  































































































































































































































































        .Value = 90  































































































































































































































































        .Operator = 7  































































































































































































































































    End With  































































































































































































































































































































































































































































































































End Sub</span>

Remarks

The IconSet object is a child object of the IconSets collection.

The icon set for the conditional format is assigned by using the IconSet property of the IconSetCondition object. You set this property to one of the built-in icon sets by passing one of the constants of the XlIconSet enumeration as an index of the IconSets property of the _Workbook object. See the example for details.

Properties

_Default[Object]

Reserved for internal use.

Application

When used without an object qualifier, this property returns an _Application object that represents the Microsoft Office Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Count

Returns a Integer value that specifies the number of icons in the icon set. Read-only.

Creator

Returns a 32-bit integer equivalent to a constant in the XlCreator enumeration that indicates the application in which this object was created. Read-only.

ID

Returns one of the constants of the XlIconSet enumeration, which specifies the name of the icon set used in an icon set conditional formatting rule.

Item[Object]

Returns an Icon object that represents a single icon from an icon set. Read-only.

Parent

Returns the parent object for the specified object. Read-only.

Methods

GetEnumerator()

Applies to