View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default 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.