B
bob.chatham
I have a range of cells to which I've applied a simple red-to-green
color scale using the Conditional Formatting menu in Excel 2007. I
want to read the resulting colors that Excel has applied to the cell
interiors from VBA to use these colors for an associated graph. As a
test, I wrote the following worksheet function to see what colors
Excel had assigned:
Function CellColor(c As Range) As Variant
Application.Volatile
CellColor = c(1, 1).Interior.Color
End Function
Regardless of the cell's color, the returned value is always 16777215;
if I use the ColorIndex property, the returned value is (-4142). Do I
need to decode these to RGB values? If so, how? I don't need to solve
this for prior versions of Excel as I realize the color handling was
much different.
Thanks for your help.
Bob
color scale using the Conditional Formatting menu in Excel 2007. I
want to read the resulting colors that Excel has applied to the cell
interiors from VBA to use these colors for an associated graph. As a
test, I wrote the following worksheet function to see what colors
Excel had assigned:
Function CellColor(c As Range) As Variant
Application.Volatile
CellColor = c(1, 1).Interior.Color
End Function
Regardless of the cell's color, the returned value is always 16777215;
if I use the ColorIndex property, the returned value is (-4142). Do I
need to decode these to RGB values? If so, how? I don't need to solve
this for prior versions of Excel as I realize the color handling was
much different.
Thanks for your help.
Bob