Thread: SumByCellColor
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SIGE SIGE is offline
external usenet poster
 
Posts: 206
Default SumByCellColor

Anyone an idea why my function does not work... it seems to unload...

Public Function SumByCellColor(Cellrange As range, Cellcolor As Single) As Single
Application.Volatile
n = 0
For Each RangeCell In Cellrange
If RangeCell.Interior.ColorIndex = Cellcolor Then
If IsNumeric(RangeCell.Value) Then n = n + RangeCell.Value
End If
Next SumByCellColor = n
End Function

Thx in advance