![]() |
Checking Number of Dimensions In Array
Does anyone know how to check the number of dimensions of an already initialized array?
|
Checking Number of Dimensions In Array
Sub test()
Dim i As Long, j As Long Dim arr(1, 2, 3, 4) As Long On Error Resume Next i = 0 Do j = LBound(arr, i + 1) If Err.Number Then Exit Do Else i = i + 1 Loop Err.Clear On Error GoTo 0 MsgBox i End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "DigableP" wrote in message ... Does anyone know how to check the number of dimensions of an already initialized array? |
Checking Number of Dimensions In Array
Smaller:
Sub test() Dim arr(1, 2, 3, 4) As Long Dim i As Long On Error Resume Next Do: i = i - (LBound(arr, i + 1) * 0 = 0): Loop Until Err.Number On Error GoTo 0 MsgBox i End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "Rob van Gelder" wrote in message ... Sub test() Dim i As Long, j As Long Dim arr(1, 2, 3, 4) As Long On Error Resume Next i = 0 Do j = LBound(arr, i + 1) If Err.Number Then Exit Do Else i = i + 1 Loop Err.Clear On Error GoTo 0 MsgBox i End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "DigableP" wrote in message ... Does anyone know how to check the number of dimensions of an already initialized array? |
All times are GMT +1. The time now is 05:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com