Setting Ranges

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
Hello,

I am trying to set a range that will go from cell A2 - the end of the data on the sheet.


Sheets("Approvals").Activate
Range("A2:Selection.End(xlDown").Copy

Can anybody let me know where i am going wrong please?

Thanks for your help.

Regards,

TD Rich.:eek:
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sheets("Approvals").Activate
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:A" & LR).Copy
 

Misca

Well-known Member
Joined
Aug 12, 2009
Messages
1,675
Here's a couple of different ways to select data. To copy the same data just change the ".select" to ".copy":
Code:
'This one selects the whole range from column A:
Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).Select
'It's from the bottom up so it doesn't stop on blanks

'This one selects the whole used range including other columns:
Range("A2", ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell)).Select
'It not only looks for values but any blank cells with some changes made on them
'(ie. font is bold or cell has color, comments or borders on it)

'The following code only selects the area with blank cells around it:
Dim Rng As Range

Set Rng = Range("A2").CurrentRegion
Rng.Offset(1, 0).Resize(Rng.Columns.Count, Rng.Rows.Count - 1).Select
'This one only selects the Range("A2").UsedRegion (without the possible row 1 data).
'I'm using Rng-variable to make it easier to read / understand
'Without the variable I'd have to replace all the Rng:s with the "Range("A2").CurrentRegion":
'Range("A2").CurrentRegion.Offset(1, 0).Resize(Range("A2").CurrentRegion.Columns.Count, Range("A2").CurrentRegion.Rows.Count - 1).Select
 

Watch MrExcel Video

Forum statistics

Threads
1,123,259
Messages
5,600,575
Members
414,390
Latest member
plimbu

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
Top