Adding cells in a range based on format color

  • Thread starter Thread starter Mo
  • Start date Start date
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
 
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
 
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + 1
That should have been:
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + c

Merjet
 
Back
Top