Sum all Cells with Interior Color Index not equal to 0

R

RyanH

I need to sum cells in Range("F5:F" & LastRow) that have a Interior Color
Index <> 0. Is there an easy way to do this?

Thanks is Advance,
Ryan
 
J

JE McGimpsey

One way:

First, 0 is not a valid value for Range.Interior.ColorIndex. I assume
you mean xlColorIndexNone instead.

For Each rCell In Range("F5:F" & LastRow)
With rCell
If IsNumeric(.Value) Then _
If .Interior.ColorIndex <> xlColorIndexNone Then _
dResult = dResult + .Value
End With
Next rCell
 

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