Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rob,
I agree with you that in many cases it's preferable to work with 0 based arrays (that is with a LOWERbound of 0) However Excel will return 1 based arrays on many of it's objects properties I believe that Tushar's comment re an UPPERBOUND of -1 may relate to some functions like split/filter or a scripting dictionary's items array which return an (0 to -1) array if no results were found. I've just written following function which gives the DIMENSIONS of an array. -1 for NO array, 0 for uninitialized etc. According to VBA help vb can handle a max of 60 dimensions. (if you dont run out of memory) Function ArrDim(vArr As Variant) As Integer Dim i% On Error Resume Next If IsArray(vArr) Then For i = 0 To 59 If IsError(LBound(vArr, i + 1)) Then Exit For Next Else i = -1 End If ArrDim = i End Function Once you know the dimensions you can safely test the lbound and ubound. HTH -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Rob van Gelder wrote : I was wondering if anyone would point that out... In my view it's wrong to set lbound to anything other than zero - I hinted at that with my Base 0 comment. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why is this returning a Ubound value of zero | Excel Discussion (Misc queries) | |||
multiple file uploading - runtime error'13': type mismatch "While Counter <= UBound(FName)" | Excel Discussion (Misc queries) | |||
UBound not in Intellisense. References problem? | Excel Programming | |||
error handling off?? | Excel Programming | |||
Ubound & Lbound | Excel Programming |