View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Creating an array of strings

List need to be a variant or not declared. Arrays by default start at 0 index

Sub test()

Dim List1
List1 = Array("aaa", "bbb", "ccc")
For i = 0 To 2
MsgBox List1(i)
Next

End Sub


"John" wrote:

How do I create a list of strings that I can cycle thru via a for loop
something like this. I can't get the syntax right, not being much of a VB
guy.

Dim List1() as String
List1 = {"aaa", "bbb", "ccc"}
For i = 1 to 3
MsgBox List1(i)
Next

I appreciate your help, -John