Add Crazy Icons : FormatConditions « Excel « VBA / Excel / Access / Word






Add Crazy Icons

 
Sub AddCrazyIcons()
    With Range("A1:C10")
        .Select ' The .Formula lines below require .Select here
        .FormatConditions.Delete
        ' First icon set
        .FormatConditions.AddIconSetCondition
        .FormatConditions(1).IconSet = ActiveWorkbook.IconSets(xl3Flags)
        .FormatConditions(1).Formula = "=IF(A1<5,TRUE,FALSE)"

        ' Next icon set
        .FormatConditions.AddIconSetCondition
        .FormatConditions(2).IconSet = ActiveWorkbook.IconSets(xl3ArrowsGray)
        .FormatConditions(2).Formula = "=IF(A1<12,TRUE,FALSE)"

        ' Next icon set
        .FormatConditions.AddIconSetCondition
        .FormatConditions(3).IconSet = ActiveWorkbook.IconSets(xl3Symbols2)
        .FormatConditions(3).Formula = "=IF(A1<22,TRUE,FALSE)"

        ' Next icon set
        .FormatConditions.AddIconSetCondition
        .FormatConditions(4).IconSet = ActiveWorkbook.IconSets(xl4CRV)
        .FormatConditions(4).Formula = "=IF(A1<27,TRUE,FALSE)"

        ' Next icon set
        .FormatConditions.AddIconSetCondition
        .FormatConditions(5).IconSet = ActiveWorkbook.IconSets(xl5CRV)
    End With
End Sub

 








Related examples in the same category

1.all the ranges that have conditional formatting set up
2.Setting Up Conditional Formats in VBA
3.Identifying Row with Largest Value in G
4.generates a three-color color scale in range A1:A10:
5.Specifying an Icon Set
6.Specifying Ranges for Each Icon
7.Using Two Colors of Data Bars in a Range
8.highlight cells above average:
9.highlight cells below average:
10.Formatting Cells in the Top 10
11.Formatting Cells in the Bottom 5
12.Formatting Cells in the Top 2 percent
13.Formatting Duplicate Cells
14.Formatting Unique Cells
15.Formatting Cells whose value between 10 and 20
16.highlights all cells that contain a capital letter A
17.highlights all dates in the past week:
18.creates the formatting shown in column A
19.Highlight the Entire Row for the Largest Sales Value
20.Using the New NumberFormat Property