Alex Rivera | Logout

Excel 2007 conditional formatting - how to get cell color?

Asked 2009-06-15T14:21:46.280
13

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?

Edit
Report

1 Answer

3

As a follow up to @richardtallent (sorry, I couldn't do comments), the following link will get you a function that returns you the color index by evaluating the conditional formatting for you.

http://www.bettersolutions.com/excel/EPX299/LI041931911.htm

answered 2009-06-17T06:44:21.417

Your Answer