Сумма ячеек указанного цвета

Распечатать
Public Function SumByColor(DataRange As Range, ColorSample As Range) As Double
     Dim Sum As Double
     Application.Volatile True
 
     For Each cell In DataRange 
         If cell.Interior.Color = ColorSample.Interior.Color Then
             Sum = Sum + cell.Value 
         End If
     Next cell 
     SumByColor = Sum 
 End Function