Function CountColor(rColor As Range, rSumRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim vResult As Integer
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = 1
Else
vResult = 0
End If
Next rCell
CountColor = vResult
End Function
I try typing "=CountColor(A1, A2)"
but I always get the error "Sub or function not defined"
Why is this? I've been stuck on this for hours.