Anyone know how to copy a Range of Cells into an Array?

GeorgeAdamson

New Member
Joined
Feb 24, 2002
Messages
14
Is there a command to do it or do I have to loop through the Range adding each cell value to the array one by one?

Thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
It's fairly straightforward to assign the cells in a range to an array. It's also a very quick way of working with large amounts of worksheet data.

Sub GetArray()
Dim vArray()
vArray = Range("A1:E10")
'vArray now contain a 10 x 5 array of values
'You can work with it and then assign it back to a range - this is much quicker
'than populating cells one at a time through a loop e.g.

Range("F1:J10").Value = vArray

End Sub


HTH,
D
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

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