User-defined function always return "#VALUE!"

tsuiwaiming

New member
Joined
Oct 1, 2007
Messages
1
Programming Experience
Beginner
Dear all,

I have been working on an Excel UDF whole afternoon. I used ParamArray to accept some strings as arguments and I wanted the function to return an integer. But what I got was the string "#VALUE!". The code is listed below.

VB.NET:
    Function vep2CountNumOfPassedPaper(ByVal ParamArray grades() As String) As Integer

        Dim numPassed As Integer = 0

        If grades.Length <= 0 Then
            Exit Function
        End If

        For i As Integer = 0 To UBound(grades, 1)

            If vep2pass(grades(i).ToString()) Then 'vep2passed is another function that determines if a certain paper is passed. 
                numPassed += 1
            End If

        Next i

        Return numPassed

    End Function

Hope someone could give me a solution. Thanks!
 

Latest posts

Back
Top