Multidimensional Array

A

Adrian T

Hi:

I have a 15x5 array (MyArray). Now I want to populate lets
say 1x15 range, i.e. "E3:S3" with only the third column
vector of MyArray. So there are two things happening here,
I need to select only the third column and to resize it
from 15x1 (the original size of the 3rd column vector) to
1x15.

Is there any way to do it without using loops?



Regards,
Adrian T
 
D

DavidMoeller

Why do you want to do it without recursion, and can you paste the code
you are currently using?
 
A

Adrian T

Hi:

Wouldn't it make any faster? If you think it wouldn't, let
me know and I'll be satisfied.

I did the similar thing with the whole array. My code
follows:

Dim arrSumActPeriodicClaims(15,5) as variant

Range("Sum_ActualPeriodicClaims").Cells(2, 2).Resize(15,
5).Value = arrSumActPeriodicClaims

I wanted to figure out how to do the similar for only one
column vector. What I have now is with loop.

intIteration = 3 '--The 3rd column vector

For i = 1 To 15
Range("Graph1_ActualPeriodicClaims").Cells(1, i + 3).Value
= arrSumActPeriodicClaims(i, intIteration)
Next i



Regards,
Adrian T
 
A

Alan Beban

Range("e3:s3").Value = _
Application.Transpose(Application.Index(MyArray, 0, 3))

Alan Beban
 
A

adriant42

Hi Alan:


Thanks for the code. It works.
I wondered if you could also help me with this question. Is there a wa
to copy the array from the 4th column vector onward? In another word,
wanted to copy only 11 values (not 15). I tried this:

Range("e3:s3").Value = _
Application.Transpose(Application.Index(MyArray, 4, 3))

It didn't work. I have been trying to find the help file fo
Application.Index, but couldn't find it. Could you please help me?



Regards,
Adrian T
 
A

Alan Beban

adriant42 said:
Hi Alan:


Thanks for the code. It works.
I wondered if you could also help me with this question. Is there a way
to copy the array from the 4th column vector onward? In another word, I
wanted to copy only 11 values (not 15). I tried this:

Range("e3:s3").Value = _
Application.Transpose(Application.Index(MyArray, 4, 3))

It didn't work. I have been trying to find the help file for
Application.Index, but couldn't find it. Could you please help me?
I'm assuming you mean you want to return the last 11 elements of the 3d
column vector of MyArray. Three possible ways occur to me: 1) code the
transfer (without looping) of MyArray to a blank worksheet, and the
extraction of the values to a separate portion of that worksheet or to
an available portion of another worksheet (and the retransfer (without
looping) of that separate range to an array, if desired); 2) make the
functions in the freely downloadable file at
http://home.pacbell.net/beban available to your workbook and use the
downloaded array functions; 3) wait for another responder to suggest
something simpler.

The resulting code for item 2) above would be something like:

Range("e3:eek:3").Value = _
Application.Transpose(SubArray(MyArray,3,3,5,15))

What's your pleasure? If item 1), include details--blank worksheet
name, and worksheet name and range for the result.

Alan Beban
 
Top