Function SumColor(CColor As Range, rng As Range)
Application.Volatile
Dim CellSum&
CIndex% = CColor.Interior.ColorIndex
For Each cl In rng
If cl.Interior.ColorIndex = CIndex Then
CellSum = WorksheetFunction.Sum(cl, CellSum)
End If
Next cl
SumColor = CellSum
End Function