Class IconCriteria (Excel VBA)

The class IconCriteria represents the collection of IconCriterion objects. Each IconCriterion object represents the values and threshold type for each icon in an icon set conditional formatting rule. To use a IconCriteria class variable it first needs to be instantiated, for example


Dim ica as IconCriteria
Set ica = ActiveCell.FormatConditions(1).IconCriteria

For Each

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


Dim icncrtIconCriteria As IconCriterion
For Each icncrtIconCriteria In ActiveCell.FormatConditions(1).IconCriteria
	
Next icncrtIconCriteria

Count

Returns a Long value that specifies the number of criteria for an icon set conditional formatting rule.

The number of criteria is equivalent to the number of threshold values assigned for an icon set.


Dim lngCount As Long
lngCount = ActiveCell.FormatConditions(1).IconCriteria.Count

Item

Returns a single IconCriterion object from the IconCriteria collection.

The value of the Index parameter cannot be greater than the number of criteria set for an icon set conditional format. The criteria are equivalent to the threshold values assigned for an icon set. To find the number of threshold values, use the Count property.

Item (Index)

Index: The index number of the IconCriterion object.


Dim icncrtItem As IconCriterion
Set icncrtItem = ActiveCell.FormatConditions(1).IconCriteria(Index:=1)