Let’s assume i have the following range from (a1:c3)
A B C
1 -1 1 1
2 -1 0 0
3 0 0 1
Now i have selected the following range, and formatted it using Conditional Formatting (using default red yellow green color scale)…. now range colors became
A B C
1 Green Red Red
2 Green Yellow Yellow
3 Yellow Yellow Red
Now I want to ask the color of any cell in the range, for example MsgBox Range(“A1”).Interior.Color
but it does not say that it is Green, why? Plz can you help me?
Range(“A1”).Interior.Color always returns 16777215
Range(“A1”).Interior.ColorIndex always returns -4142
(no matter whether the color of A1 is red, blue, green, …)
Range(“A1”, “C3”).FormatConditions.Count
this one returns always 0, why?
since i may have more than three different colors in a time… i didn’t find any good way of handling this with conditional formatting’s default colors… i did it this way. then whenever i ask the color of the cell, i retrieve the correct color!
d_distinct holds all the distinct values in a range… c is a Color[] which holds distinct colors for every distinct value! this code can easily be translated to vb!