Row Selection

The_Rock

Board Regular
Joined
Jul 2, 2007
Messages
174
Hi
In my macro, I'm selecting a Range that Starts from A2:AK***

Normally I would record the macro using
Code:
 Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select

The problem is that not all of 'Column M' is populated and if it is the last cell thats empty, then it will stop there. There are a couple of other columns which also have some empty cells.

Is there anyway of having a formula that will allow me to scroll down to the last data of Column A (Data is variable) but then have it hardpaste across to Column AK so that the entire data in the range is selected??

Thanks in advance
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
can you not use UsedRange property ?

eg

Code:
Dim rng as range
Set rng = ActiveSheet.UsedRange
rng.Select
 
Last edited:
Upvote 0
Unfortunately, I'm not too familar with VBA codings.
Most of my macro's are done via the record button with a few manual tweaks here and there.

I'll give the below a try.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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