Copy array to another workbook

flynavy

New Member
Joined
Mar 18, 2015
Messages
43
I have some complicated VBA code to populate a 2-D array (250 by 366). When the array has been populated, I want to copy the array to another workbook. I believe there is a way to efficiently copy en masse with very simple code. Any thoughts?
 
Hi flynavy,

You have not given us a whole lot to work with, but how about after the array is populated you use Resize on the upper left destination cell and make it equal to the array.

Generically, something like this...

If you have a 2 dimensional array, you need to use Resize to resize the destination range to the proper size. The first dimension is the number of rows and the second dimension is the number of columns. The code below illustrates writing an array Arr out to the worksheet starting at cell A1.


Code:
Dim Destination As Range
Set Destination = Range("A1")

Destination.Resize(UBound(Arr, 1), UBound(Arr, 2)).Value = Arr

HTH

igold
 
Upvote 0

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