Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find the dimension of an array?

Status
Not open for further replies.

ramki431

IS-IT--Management
Aug 8, 2001
6
US
Can you please tell me, how to find the dimension of an array. I got a variant array as a return parameter from a function. I want to know whether the returned array is Single dimension or 2 dimension array.
 
This is not pretty but it works:

Private Sub CheckArray()
Dim iX As Long
Dim iY As Long

iX = 0
iY = 1
Do While 1
On Error GoTo ErrTrap
iX = UBound(myArr, iY)
iY = iY + 1
Loop
Exit Sub
ErrTrap:
MsgBox "There is " & CStr(iY - 1) & " Dimensions"
End Sub

Hope this helps Anything is possible, the problem is I only have one lifetime.
[cheers]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top