LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to search an Array of Strings Aaron Excel Programming 1 June 10th 08 08:11 PM
Creating strings for legend [email protected] Excel Discussion (Misc queries) 4 April 27th 08 12:59 PM
question about creating variable from 2 strings Gary Keramidas Excel Programming 2 August 21st 07 09:50 PM
Array of Strings Zone Excel Discussion (Misc queries) 3 July 7th 06 04:52 PM
Counting Strings in an Array ExcelMonkey[_190_] Excel Programming 9 March 16th 05 09:21 AM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"