36
IconSetCondition Object Example
This example adds an icon condition that tags a range of values with one of three colored flags:
Sub CreateIconConditions()
Dim oIconCondition As IconSetCondition
‘Add an icon set condition
Set oIconCondition = Range(“F6:F16”).FormatConditions.AddIconSetCondition
‘Choose the 3Flags icon set
oIconCondition.IconSet = ActiveWorkbook.IconSets(xl3Flags)
‘Set the threshold for Green flag; above 80 percent is green.
With oIconCondition.IconCriteria(3)
.Type = xlConditionValuePercent
.Operator = xlGreater
.Value = 80
End With
‘Set the threshold for Yellow flag; 70 percent and above is yellow.
‘Values that qualify for green will not be tagged as yellow.
‘Any values that do not qualify for yellow or green will be red.
With oIconCondition.IconCriteria(2)
.Type = xlConditionValuePercent
.Operator = xlGreater
.Value = 70
End With
‘Show only the flag icons; not the data values
oIconCondition.ShowIconOnly = True
End Sub
Interior Object
The Interiorobject contains the formatting options associated with the inside area of the parent object.
Possible parents of the Interiorobject are the AboveAverage, AxisTitle, ChartArea, CellFormat,
ChartObject, ChartTitle, DataLabel, DownBars, Floor, FormatCondition, Legend, LegendKey,
OLEObject, PlotArea, Point, Range, Series, Style, TableStyleElement, Top10, Style, Upbars,
and Wallsobjects. The ChartObjects, DataLabels, OLEObjects, and UniqueValuescollections also
are possible parents of the Interiorobject.
Interior Common Properties
The Application, Creator, and Parentproperties are defined at the beginning of this appendix.
765
IconSetCondition Object Example