Try it like
Function SumByColor(SumRange As Range, SumColor As Range)
Dim SumColorValue As Integer
Dim TotalSum As Long
SumColorValue = Evaluate("getcfcolour(" & SumColor.Address(, , , 1) & ")")
Set rCell = SumRange
For Each rCell In SumRange
If Evaluate("getcfcolour(" & rCell.Address(, , , 1) & ")") = SumColorValue Then
TotalSum = TotalSum + rCell.Value
End If
Next rCell
SumByColor = TotalSum
End Function
Private Function GetCFColour(Cl As Range) As Long
GetCFColour = Cl.DisplayFormat.Interior.ColorIndex
End Function
Bookmarks