Conditional formatting with pictograms

SaskiaHe

New Member
Joined
Apr 14, 2009
Messages
20
Hello,

I'm using the code below to apply conditional formatting with pictograms to a range of cells.

Now I want to check a pictogram in a cell. Whether is has a green or a red arrow or something like that. How can I accomplish that?

Any help would be greatly apprecated.

Saskia

Code:
    Range("G8:K14").Select
    With Selection.FormatConditions(1).IconCriteria(2)
        .Type = xlConditionValuePercent
        .Value = 20
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(3)
        .Type = xlConditionValuePercent
        .Value = 40
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(4)
        .Type = xlConditionValuePercent
        .Value = 60
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(5)
        .Type = xlConditionValuePercent
        .Value = 80
        .Operator = 7
    End With
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
My apologies, the code above is not correct. Below is the right one:

Code:
Range("G8:K14").Select
    Selection.FormatConditions.AddIconSetCondition
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1)
        .ReverseOrder = False
        .ShowIconOnly = False
        .IconSet = ActiveWorkbook.IconSets(xl5Arrows)
    End With
    With Selection.FormatConditions(1).IconCriteria(2)
        .Type = xlConditionValuePercent
        .Value = 20
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(3)
        .Type = xlConditionValuePercent
        .Value = 40
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(4)
        .Type = xlConditionValuePercent
        .Value = 60
        .Operator = 7
    End With
    With Selection.FormatConditions(1).IconCriteria(5)
        .Type = xlConditionValuePercent
        .Value = 80
        .Operator = 7
    End With
 
Upvote 0
if nobody can answer this question, can anybody tell me how the values are divided into the 5 groups?
I understand it roughly, but don't seem to be able to reproduce exactly.

Thanks in advance.
 
Last edited:
Upvote 0
Does nobody understand how conditional formatting with icons work?

I'm trying to classify data into 5 categories and to determine in VBA to which category a value in a cell belongs.
As nobody answers, this either seems to be a very stupid question or Excel makes it so difficult that nodbody understands ...

If anybody understands though, please, please help me.
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,835
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top