Count the number of times a cell is colored with conditional formatting

D

DrSues02

I have been trying to figure out how to count the number of times a cel
is colored using conditional formatting.

I have looked through the old threads and still cannot find
solution.

I need to add up the # of times a cell is a certain color (Green) in
particular row.

However, the criteria for the cell to become green is different fro
row to row. In most of the rows, there is only one condition whic
highlights the cell green; it is left blank if it doesn't satisfy thi
condition. In others, there are two conditions: one that highlight
green and one that highlights red. I need to add up the number o
green and red in the row.

I have done searches on this topic before and was pointed to a websit
which tries to explain a VBA code for this.

However, I cannot make heads or tails of this.

If anyone could help, I would greatly appreciate any suggestions.

Thanks.

DrSues0
 
M

Myrna Larson

If it is colored by conditional formatting, the only way to count them is to
use a formula with the same logic that you used to set the color.
 
L

Leo Merikallio

Your best bet would be to use ...Interior.ColorIndex

For example 4 and 10 are two basic shades of green. You just have to
make a loop that goes through every cell and looks for the
color/colors youre after.
 
L

Leo Merikallio

forgot something...

If Youre looking for green cells (conditional formatting) which dont
have a interior.colorindex of green then You cant use what I just
posted.

You can put the same functionality that the conditional formatting
does into your code and looking the other way if that particular Cell
is green to your macro or not. Like if the conditional formatting
triggers on even numbers You just check in the code whether the cell
in question is even (green) or not. And then add it to the totals
combined with the "really green" cells :)

Cheers,
LM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top