Sum all Cells with Interior Color Index not equal to 0

  • Thread starter Thread starter RyanH
  • Start date Start date
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
 
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
 
Back
Top