Option Explicit

Public Function SumColor(ByVal cells As Range, _
                         ByVal sample As Range) As Double
    Application.Volatile
    Dim cell As Range
    Dim total As Double
    For Each cell In cells.Cells
        If cell.Interior.Color = sample.Cells(1, 1).Interior.Color Then
            If Not IsError(cell.Value2) Then
                If VarType(cell.Value2) <> vbString And _
                   VarType(cell.Value2) <> vbBoolean Then
                    If IsNumeric(cell.Value2) Then
                        total = total + CDbl(cell.Value2)
                    End If
                End If
            End If
        End If
    Next cell
    SumColor = total
End Function
