Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet Function to Create Array of Size n with values x Through | Excel Discussion (Misc queries) | |||
Is there an array size limit for MMULT or MINVERSE in excel 2007? | Excel Worksheet Functions | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
Array size | Excel Programming | |||
Can we write VBA code to set all column/row's size back to default size? | Excel Programming |