# Write Part of Array to Range

• Hello
I can use a little help on this question.

I have a 3 Dim dinamic array, say, ArrV(1 to 2, 1 to 5000, 1 to 500) as double and I am looking for a fast way to write a 2 Dim part of it ArrV(1, allrows, allcolumns) to a range, such as

RangeRg = ArrV(1), or RangeRg = ArrV(2)
This results in a compiler error

ArrV is dinamic. Only the 1st dimension is fixed 1 to 2.

If the array ArrV was 2 Dim then RangeRg= ArrV does the job clean and quickly.
But as it is a 3 dim array, how can I do it without having to copy every single element to a new 2 dim array?

Is there a way to do it FAST?

Thanks in advance for any help or suggestions.

• Hello Kenneth Hobson
Many thanks for the quick reply. I apologise for this late reply.
I tried to figure out some solution, eventually using INDEX, but I was unable to make it to return a 2 dim array.

Eventually I should instead have dimmed the array, not as a 3 dim array, but as an array(1 to 2) of 2 dim arrays(1 to 5000, 1 to 500). (i.e. an array of arrays).
This way could probably use the standard assignment like Range = array(1 to 5000, 1 to 500).

Always learning....

PS I couldn't acces the site on your a.m. link. Alway got access denied.
Best Regards

• Hmm, link still works for me. Here is part of snb's code there:

These can make use of Evaluate too, to help build it. e.g.

Code
``````'http://www.snb-vba.eu/VBA_Arrays_en.html#L_6.1.1
b = Application.Index(a, Evaluate("row(1:" & i & ")"), Application.Transpose([row(1:2)]))``````
• I finally got to the link yesterday (from my home connection). What a bible!
I will dig into it next couple of days.
Many thanks

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!