Class Icon (Excel VBA)

The class Icon represents a single icon in an icon set used in a conditional formatting rule.


To use a Icon class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim isc As IconSetCondition: Set isc = 
Dim icnIconSet As Icon
Set icnIconSet = isc.IconSet(Index:=lngIndex)

The following procedures can be used to set variables of type Icon: IconSet.Item, Parent, IconSetCondition.IconSet and IconSets.Item

For Each

Here is an example of processing the Icon items in a collection.

Dim icn As Icon: Set icn = 
Dim icnParent As Icon
For Each icnParent In icn.Parent
Next icnParent


Returns a Long value specifying the index number of the Icon object within the IconSet object.


Returns the parent object for the specified object.


Returns a Long value that specifies the number of icons in the icon set.


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.

Possible Values are xl3Arrows - 3 Arrows, xl3ArrowsGray - 3 Arrows Gray, xl3Flags - 3 Flags, xl3Signs - 3 Signs, xl3Stars, xl3Symbols - 3 Symbols, xl3Symbols2, xl3TrafficLights1 - 3 Traffic Lights 1, xl3TrafficLights2 - 3 Traffic Lights 2, xl3Triangles, xl4Arrows - 4 Arrows, xl4ArrowsGray - 4 Arrows Gray, xl4CRV - 4 CRV, xl4RedToBlack - 4 Red To Black, xl4TrafficLights - 4 Traffic Lights, xl5Arrows - 5 Arrows, xl5ArrowsGray - 5 Arrows Gray, xl5Boxes, xl5CRV - 5 CRV, xl5Quarters - 5 Quarters, xlCustomSet.


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

The value of the Index parameter cannot be greater than the number of icons in an icon set. To find the total number of icons in an icon set, use the Count property.

Syntax : expression.Item (Index)

Index: The index number of the Icon object.


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