View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leo Heuser Leo Heuser is offline
external usenet poster
 
Posts: 266
Default Arrays - Lower Bound and Singleline Assignment

"Goofy" skrev i en meddelelse
...
Hi,

Is there a way to set the bounds explicitly using the 'To' and then do the
assignment on one line

something like

Dim myArray( 1 to 20 ) as string
myArray = {"one","two","Three"}

??



Hi

If you have Excel 2000 or later, you can use the "Split" function:

Sub test()
Dim MyArray As Variant

MyArray = "One,Two,Three"
MyArray = Split(MyArray, ",")
End Sub

Split *always* return a zero-based array,
even when you do an "Option Base 1"!

--
Best regards
Leo Heuser

Followup to newsgroup only please.