Selecting a Range of all cells from A2 to End of Data

Muleskin57

New Member
Joined
Dec 22, 2016
Messages
23
I'm attempting to move input data from one sheet to another, but am having trouble defining the range to cut. I know it starts at cell A2, but the range would go to the last row containing values (excluding blank cells with formulas or unselected dropdown menu choices). Any help would be greatly appreciated.
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
The simple answer is to set a variable for the last row and use it in the select:
Code:
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Range("A2:A" & LR).Select
Your question implies that you also want to exclude blank cells or cells with formula - if so, then you'd have to set a filter.
 
Upvote 0
If you just want to exclude unused rows below the data, that may have formulae returning "", try
Code:
   Dim Lr As Long
   Lr = Cells.Find("*", , xlValues, , , , False, , False).Row
 
Upvote 0
The simple answer is to set a variable for the last row and use it in the select:
Code:
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Range("A2:A" & LR).Select
Your question implies that you also want to exclude blank cells or cells with formula - if so, then you'd have to set a filter.

Perfect! I just substituted my last column as R and it worked perfectly. Range("A2:R" & LR).Select

Much more simple that what I was getting into. Thanks a heap.
 
Upvote 0

Forum statistics

Threads
1,207,259
Messages
6,077,347
Members
446,279
Latest member
hoangquan2310

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