#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Array Size

Hello again,

How can i get the Size of the Array ? that is I have an Array which is
dynamic and at the end i would like to know the number of elements in the
array and then do further processing.

Regards,
SSR



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Array Size


"Srinath" wrote in message
...
Hello again,

How can i get the Size of the Array ? that is I have an Array which is
dynamic and at the end i would like to know the number of elements in the
array and then do further processing.

Regards,
SSR




Use the Ubound function

Dim Upper
Dim MyArray(1 To 10, 5 To 15, 10 To 20) ' Declare array variables.
Dim AnyArray(10)
Upper = UBound(MyArray, 1) ' Returns 10.
Upper = UBound(MyArray, 3) ' Returns 20.
Upper = UBound(AnyArray) ' Returns 10.

Keith


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Array Size

Thanks

"Keith Willshaw" wrote in message
...

"Srinath" wrote in message
...
Hello again,

How can i get the Size of the Array ? that is I have an Array which is
dynamic and at the end i would like to know the number of elements in the
array and then do further processing.

Regards,
SSR




Use the Ubound function

Dim Upper
Dim MyArray(1 To 10, 5 To 15, 10 To 20) ' Declare array variables.
Dim AnyArray(10)
Upper = UBound(MyArray, 1) ' Returns 10.
Upper = UBound(MyArray, 3) ' Returns 20.
Upper = UBound(AnyArray) ' Returns 10.

Keith



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Array Size

SSR,

Use something like

NumElements = UBound(Arr) - LBound(Arr) + 1


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Srinath" wrote in message
...
Hello again,

How can i get the Size of the Array ? that is I have an Array

which is
dynamic and at the end i would like to know the number of

elements in the
array and then do further processing.

Regards,
SSR





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Array Size

If by Size he means the count of the number of elements (rather than the index of the last
element) you also need the LBound function. UBound gives the number of elements only if the
lower bound is 1.

NumElements = Ubound(Ary) - LBound(Ary) + 1


On Fri, 15 Aug 2003 11:07:36 +0100, "Keith Willshaw" wrote:


"Srinath" wrote in message
...
Hello again,

How can i get the Size of the Array ? that is I have an Array which is
dynamic and at the end i would like to know the number of elements in the
array and then do further processing.

Regards,
SSR




Use the Ubound function

Dim Upper
Dim MyArray(1 To 10, 5 To 15, 10 To 20) ' Declare array variables.
Dim AnyArray(10)
Upper = UBound(MyArray, 1) ' Returns 10.
Upper = UBound(MyArray, 3) ' Returns 20.
Upper = UBound(AnyArray) ' Returns 10.

Keith


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Function to Create Array of Size n with values x Through Dial222 Excel Discussion (Misc queries) 1 December 6th 07 11:21 AM
Is there an array size limit for MMULT or MINVERSE in excel 2007? jimr315 Excel Worksheet Functions 4 February 7th 07 10:48 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
Array size ten Excel Programming 6 August 12th 03 09:16 AM
Can we write VBA code to set all column/row's size back to default size? Earle Excel Programming 0 July 8th 03 02:46 PM


All times are GMT +1. The time now is 10:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"