View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default How to find out the size of a variable-size array ?

UBound / LBound are what you're after.

If you want to know the number of dimensions: Check my website for "Number
of Dimensions"
(posted here for archive)

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


"Adrian" wrote in message
...
Hi,

Is there a function to find out the size of a variable size array ?
Thanks.

regards,
Adrian