I am having trouble with a user defined function. I have pared down the function to this:
Function ARRAYTEST (a() as Variant) as String
Dim i as Integer
Dim result as string
i = 2
result = a(i)
ARRAYTEST = result
End Function
In the Calc spreadsheet I use the function:
=ARRAYTEST(A1:A5)
The cells A1:A5 contain a,b,c, ,e
When I run it I get this error on the line: result = a(i)
The error is: “Inadmissible value or data type. Index out of defined range.”
If I change the array to As String, I get this message: “BASIC runtime error. Object variable not set.”
Can anyone tell me what I am doing wrong?
Thanks,
Robert.