Adding cells in a range based on format color

M

Mo

Would anyone like to tell me how it would be possible to add only the cells
that are colored e.g. red through a range

Mo
 
M

merjet

Would anyone like to tell me how it would be possible to
add only the cells that are colored e.g. red through a range

Function SumRed(Target As Range) As Integer
Dim c As Range

For Each c In Target
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + 1
Next c
End Function

HTH,
Merjet
 
M

merjet

If c.Interior.ColorIndex = 3 Then SumRed = SumRed + 1
That should have been:
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + c

Merjet
 

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