View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Add dimesion to Array already populated

ExcelMonkey wrote:
Sorry Allan. I have 1D array with rows populated. I have done so doing the
following:

BigArray = Split(StringList, " ")

I was trying to avoid looping (for no real reason). I wasn't sure if could
still populate all the rows in the first dimension (like i did above) of the
Array if had in fact dimensioned it as 2D array. so I was wondering can you
add a dimension to the array after I have populated the rows in the first
dimension or can dim as 2D and still use the syntax above to populate 1D?

The following will produce a BigArray of one dimension, bounds 0 to 2:

Dim BigArray
ReDim BigArray(0 To 0, 0 To 2)
StringList = "foo1 foo2 foo3"
BigArray = Split(StringList, " ")

But if the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook, the
following will produce a 2-D array with the first row loaded, bounds 0
to 0, 0 to 2:

Dim BigArray
StringList = "foo1 foo2 foo3"
BigArray = Split(StringList, " ")
BigArray = TwoD(BigArray)

Alan Beban