Selecting Range using .end(xldown) & .end(xlright)

finaljustice

Board Regular
Joined
Oct 6, 2010
Messages
175
Hi there! This is definately a quick question, but I need to select a range. I'm looking to do so along these lines:
Code:
Range("Activecell.End(xlDown)", "Active.End(xlToRight)").Select

This is definately a problem of not knowing the right jargon to do so.

Could someone please assist?

Thanks in advance!
final
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try

Code:
Dim LR As Long, LC As Long
LR = ActiveCell.End(xlDown).Row
LC = ActiveCell.End(xlToRight).Column
Range(ActiveCell, Cells(LR, LC)).Select
 
Upvote 0
Try

Code:
Dim LR As Long, LC As Long
LR = ActiveCell.End(xlDown).Row
LC = ActiveCell.End(xlToRight).Column
Range(ActiveCell, Cells(LR, LC)).Select

Elegant solution, ty. But for curiosity, is it possible to do as I originally inteded? maybe using "Range(cells(),cells()).select"?

thanks you in advance once again.
 
Upvote 0
As a one-liner

Code:
Range(ActiveCell, Cells(ActiveCell.End(xlDown).Row, ActiveCell.End(xlToRight).Column)).Select


Beautifull, I was trying to do so, but I was forgetting the .row & .column and couldn't see what i was doing wrong.
Thanks!
 
Upvote 0
You are welcome.

For what it's worth you don't actually need to select that range in order to work with it. For example

Code:
Range(ActiveCell, Cells(ActiveCell.End(xlDown).Row, ActiveCell.End(xlToRight).Column)).Interior.ColorIndex = 3
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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