I cannot tell if the function was entered for array evaluation. But depending on the specific case you will find a way to decide that depending on what was passed for the parameters. In most cases it may suffice to decide if (at least one of …) an array was passed for a parameter. Till now I never had a case where I needed that, but you can, of course use a parameter the user can explicitly tell with if array evaluation is needed. User shouldn’t lie about such things anyway. …
Let me demonstrate the way I do things of the kind by a simple example:
Function firstCharacters(pIn)
If Not IsArray(pIn) Then
Dim h(1 To 1, 1 To 1)
h(1, 1) = pIn
pIn = h
End If
l1 = Lbound(pIn(), 1) : u1 = Ubound(pIn(), 1)
l2 = Lbound(pIn(), 2) : u2 = Ubound(pIn(), 2)
Dim r(l1 To u1, l2 To u2) As String
For y = l1 To u1
For x = l2 To u2
r(y, x) = Left(pIn(y, x), 1)
Next x
Next y
firstCharacters = r
End Function
This will also work in the exceptional case that pIn is a single value/variable.
You need to use an untyped (Variant) parameter. (You may test, of course each element for its ‘Typename’.)