VBA Array Subset Assignment

Tom Neville

New Member
Joined
Aug 5, 2011
Messages
2
Is there a way to specify a "range" of "cells" in a VBA array that allows the following actions:

I am working with large 2D arrays. I would like to assign part of the array to a Range and assign a Range to part of an array. For a simple example, I would like to select a row "record" from the data in a 2D array and assign it to a Range as a row "record" on a worksheet. Alternatively, I would like repeatedly to select a Range that is a row "record" on a worksheet and assign it to the next "row" in a large array.

I have not been able find documentation that shows how to specify a "range" in an array, other than cell by cell - MyArray(i,j)=Cells(k,l).

Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Indeed, you will have to loop cell by cell. But in memory working with arrays is usually very very fast.

For reading from and writing to the sheet, read and write in 1 operation, not cell by cell.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,839
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top