0
votes

Just to confirm that this is NOT JUST conditional formatting! I'm using Excel 2010.

I have used http://www.cpearson.com/excel/colors.aspx ColorIndexOfOneCell function, but it doesnt seem to identify the Conditionally Formatted cell colors. The following code has been used, with the relevant cell color in C89:

=SUMPRODUCT(--(colorindex(L6:L82)=ColorIndexOfOneCell($C$89,FALSE,1)))

Any ideas?

PS. When manually changing the cell colors ("behind" the conditional formatting), ColorIndexOfCell DOES pick it up.

1

1 Answers

1
votes

Googling "excel conditional formatting color applied vba" yields a link: http://www.cpearson.com/excel/cfcolors.htm (heay same source). It suggests checking with their ActiveCondition script.

Or alternatively: "vba excel check active condition" yields an alternative code on this page:

http://en.kioskea.net/faq/1409-excel-vba-a-function-that-returns-the-color-of-an-active-mfc Even more elegant.

Both come down to looping through possible FormatConditions and then checking in the script if the condition is met. When the condition is met the color of that condition is taken.