Test if a variable is given as array?
Since arrays have Ubounds and simple variables do not, we can test for this:
Sub qwerty(t As Variant)
On Error GoTo NotArray
x = UBound(t)
MsgBox (x)
Exit Sub
NotArray:
MsgBox ("clearly not an array")
End Sub
Sub routine()
Dim inputt As String
inputt = "A"
Call qwerty(inputt)
End Sub
--
Gary''s Student - gsnu200847
"Charlotte E" wrote:
Hello,
Is it possible to test if a variable is given as array?
I need to pass on a value to an UDF in VBA, but it must be given as an
array, i.e.:
MyVar = Array("A")
rather than:
MyVar = "A"
Is it possible to test if 'MyVar' is an array?
TIA,
CE
|