Unfortunately, you can only expand on the last dimension (second dimension in
this case).

So you could treat your rows as columns and columns as rows.

an alternative would be to use a variant one dimensional array and read each
row into another variant one dimensional array (1 to # Columns), then assign
that to each elemement of the original variant and expand that array

Some pseudo code:

Dim v() as Variant
Dim dum(1 to 13) as Variant

redim v(1 to 1)
' code to open file
do while not eof()
' populate Dum
for i = 1 to 13
dum(i) = . . .
v(ubound(v)) = dum
redim preserve v(1 to ubound(v) + 1)
redim preserve v(1 to ubound(v) - 1)

for i = 1 to ubound(v)
debug.print v(i)(1), v(i)(2), v(i)(3), . . . , v(i)(13)

Tom Ogilvy

"ispy99" wrote:

> All,
> I am trying to write some VBA code for an excel application. I need to read
> in a CSV file with a set number of fields but variable number of rows. I
> have been able to open the file and read the contents, however I am having a
> problem loading the data into an array. I believe I am simply not
> understanding how to work with multidimensional dynamic arrays. In this case
> I have two fields with a variable number of rows. I know in other languages
> like Java I would instantiate a Vector (for example) and then add as many
> elements as I needed. VBA seems to require knowing the size of the array
> when it is created with Dim. Any suggestions?