View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeremiah Jeremiah is offline
external usenet poster
 
Posts: 49
Default Function returns #Name?

I am using a SumColor function and is returning the #Name? error. Haven't
used many functions so don't quite understand what the issue is.

code is below along with =SumColor (A10, D1D60)

Function SumColor(rColor As Range, rSumRange As Range)

Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex

For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.SUM(rCell) + vResult
End If
Next rCell

SumColor = vResult
End Function

Thanks again for any help.