Putting a Range into an Array

business_analyst

Board Regular
Joined
Jun 5, 2009
Messages
99
Hello All,

So I would like to put a certain range into an array, which would seem easy enough using a variant, however, I am running into a few issues. First off, the range I would like to use may change in length and also has a header that I don't want included in the array. I know that utilizing end(xlUp) I can find the last cell in the column, but how would I use that to actually select a range?

For a full picture, there is a worksheet with a list of ID's located in column A. I would like to take A2 through the end of the list and send that to an array.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try:-
Code:
Dim iLastRow As Long
Dim vStore() As Variant
iLastRow = Cells(Rows.Count, 1).End(xlUp).Row
vStore = Application.Transpose(Range("A2:A" & iLastRow))
 
Upvote 0
Thanks Ruddles, used that and it worked perfectly. I didn't think that you can split up a Range with variables. I'm sure that will come in handy with future coding as well . Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,792
Members
452,942
Latest member
VijayNewtoExcel

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