View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Function returns #Name?

Without looking at your code, the formula you are putting in your cell is
not correct... there should not be a space between the function name and the
opening parenthesis and your second argument is missing the colon separator
between the two cell addresses. It should be...

=SumColor(A10, D1:D60)

--
Rick (MVP - Excel)


"jeremiah" wrote in message
...
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.