Test if a variable is given as array?
Thanks!
--
Gary''s Student - gsnu200847
"joel" wrote:
Use ISARRAY
Dim MyArray(1 To 5) As Integer, YourArray, MyCheck ' Declare array
variables.
YourArray = Array(1, 2, 3) ' Use Array function.
MyCheck = IsArray(MyArray) ' Returns True.
MyCheck = IsArray(YourArray)
"Gary''s Student" wrote:
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
|