Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
I'm programming VBA in Excel 2003.
I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
BeefmanSteve wrote:
I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. UBound(MyArray) - LBound(MyArray) + 1 Alan Beban |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
Hi BeefmanSteve,
Sub Tester() Dim Arr As Variant Dim NumOfElements As Long Arr = Array("aaa", "bbb", "cccc") NumOfElements = UBound(Arr) - LBound(Arr) + 1 MsgBox NumOfElements End Sub --- Regards, Norman "BeefmanSteve" wrote in message ... I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
dim myArr as variant
dim iCtr as long myarr = array("a","qwer","qwerqwer","asdf") for ictr = lbound(myarr) to ubound(myarr) msgbox myarr(ictr) next ictr BeefmanSteve wrote: I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
For i = LBound(ary) To UBound(ary) Debug.Print ary(i) Next i -- HTH RP (remove nothere from the email address if mailing direct) "BeefmanSteve" wrote in message ... I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I find the number of elements in an Array of Strings?
On Thu, 16 Jun 2005 16:08:01 -0700, BeefmanSteve
wrote: I'm programming VBA in Excel 2003. I wish to index through a loop for each element in an array. But I need to refer to the elements by their index number, not their value as a string. How can I find the number of elements in an array of strings? Thanks. Look at the LBound and UBound functions. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Maximum number of elements in array | Excel Discussion (Misc queries) | |||
Counting the Number of Elements in an Array | Excel Discussion (Misc queries) | |||
How to find number of pairs of strings from list of strings? | Excel Worksheet Functions | |||
What is the maximum allowed number of data elements in a data array? | Excel Discussion (Misc queries) | |||
Counting the number of elements within an array that have data | Excel Programming |