Hi,
I'm having some difficulty getting data into arrays greater than one
dimension. I can do it if I specify every single element individually
but there has to be a faster way. I thought something like this would
work:

Dim arrVal (3,3)
arrVal(0) = Array(1, "ONE", "A")

also tried this:
arrVal(0,) = Array(1, "ONE", "A")

and of course:
arrVal(0) = (1, "ONE", "A")

The only thing that seems to work is this:
arrVal(0,0) = 1
arrVal (0,1) = "One"
arrVal (0,2) = "A"

Is there an easier way?

Thank You

Re: populating multidimensional arrays by Michael

Michael
Wed Jan 24 18:48:32 CST 2007

> The only thing that seems to work is this:
> arrVal(0,0) = 1
> arrVal (0,1) = "One"
> arrVal (0,2) = "A"
>
> Is there an easier way?

Not with true multi-dimentional arrays.

--
Michael Harris
Microsoft.MVP.Scripting



Re: populating multidimensional arrays by Anthony

Anthony
Thu Jan 25 05:43:15 CST 2007


<everymn@yahoo.com> wrote in message
news:ujnfr2t72bh6tgb7aifumujkjakq9sos1h@4ax.com...
> Hi,
> I'm having some difficulty getting data into arrays greater than one
> dimension. I can do it if I specify every single element individually
> but there has to be a faster way. I thought something like this would
> work:
>
> Dim arrVal (3,3)
> arrVal(0) = Array(1, "ONE", "A")
>
> also tried this:
> arrVal(0,) = Array(1, "ONE", "A")
>
> and of course:
> arrVal(0) = (1, "ONE", "A")
>
> The only thing that seems to work is this:
> arrVal(0,0) = 1
> arrVal (0,1) = "One"
> arrVal (0,2) = "A"
>
> Is there an easier way?
>
> Thank You

Do you really need a multi-dimensional array or would an array of arrays
do:-

Dim arrVal(3)

arrVal(0) = Array(1, "ONE", "A")

MsgBox arrVal(0)(1) ' displays ONE




Re: populating multidimensional arrays by everymn

everymn
Thu Jan 25 15:07:01 CST 2007

Ah Okay cool that does it. My mistake was in defining the second
dimension in advance.
Thanks

>
>Do you really need a multi-dimensional array or would an array of arrays
>do:-
>
>Dim arrVal(3)
>
>arrVal(0) = Array(1, "ONE", "A")
>
>MsgBox arrVal(0)(1) ' displays ONE
>
>

Re: populating multidimensional arrays by Michael

Michael
Thu Jan 25 18:19:31 CST 2007

everymn@yahoo.com wrote:
> Ah Okay cool that does it. My mistake was in defining the second
> dimension in advance.
> Thanks
>


Fabulous Adventures In Coding : Running Me Ragged
http://blogs.msdn.com/ericlippert/archive/2003/09/22/53069.aspx


>>
>> Do you really need a multi-dimensional array or would an array of
>> arrays do:-
>>
>> Dim arrVal(3)
>>
>> arrVal(0) = Array(1, "ONE", "A")
>>
>> MsgBox arrVal(0)(1) ' displays ONE

--
Michael Harris
Microsoft.MVP.Scripting