Range or Array?
Consider:
If IsArray(rng) Then
If TypeOf rng Is Range Then
MsgBox "Range"
Else
MsgBox "Array"
End If
End If
But neither this nor Bob Phillips's version below distinguishes between
a Variant() array and an array contained within a Variant Variable. I
don't know of a way to do that if the array is passed to a sub procedure
or function, but I have difficulty seeing why one would care.
In the abstract, one can see it in the Declaration statement. E.g.,
after Dim myArray1 As Variant, myArray2() As Variant
myArray1 is a Variant variable, myArray2 is a Variant() type array.
Alan Beban
Bob Phillips wrote:
If TypeName(rng) = "Range" Then
MsgBox "Range"
ElseIf TypeName(rng) = "Variant()" Then
If IsArray(rng) Then
MsgBox "Array"
End If
End If
|