For 20 values, I am not sure the individual assignment approach is
particularly costly.
Option Explicit
Sub main()
Dim v As Variant, i As Integer
v = Split("abc,def,ghi,jkl", ",")
Debug.Print "------------"
For i = LBound(v) To UBound(v)
Debug.Print v(i)
Next
Debug.Print "------------"
v = Array("mno", "pqr", "stu", "vwx")
For i = LBound(v) To UBound(v)
Debug.Print v(i)
Next
End Sub
"John Michl" wrote in message
...
Simple question. How do I load a list of strings into an array?
I know I code so the following but it seems inefficient.
Dim a (1 to 20) as String
a(1) = "String1"
a(2) = "String2"
etc...
Can I do something like...
a(1 to 20) = "String1", "String2", "String3" ....."String20"
or
a = Array("String1", "String2", "String3" ....."String20" )
Thanks.
- John Michl
www.JohnMichl.com