PDA

View Full Version : [SOLVED:] Count item in array



Cass
09-26-2005, 05:17 AM
How to count items in array

Arr1= array("aa", "bb", "cc")
Reason why i need this is using many For .... next methods.
example: For i=0 to X 'x is number how many items is in array

Bob Phillips
09-26-2005, 05:39 AM
How to count items in array

Arr1= array("aa", "bb", "cc")
Reason why i need this is using many For .... next methods.
example: For i=0 to X 'x is number how many items is in array


For i = Lbound(Arr1) To UBound(Arr1)

Cass
09-26-2005, 05:49 AM
ouh so easy :doh:

thanks

MWE
09-26-2005, 06:40 AM
How to count items in array
Arr1= array("aa", "bb", "cc")
Reason why i need this is using many For .... next methods.
example: For i=0 to X 'x is number how many items is in array
Assuming you want to count the # of times any element occurs in the array, you might also see this KB (http://vbaexpress.com/kb/getarticle.php?kb_id=708) It will probably do what you want and has pretty broad utility

Cass
09-26-2005, 07:40 AM
yes i mean count arry items but UBound do what I mean the code to do :rotlaugh: