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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 

finaljustice

Board Regular
Joined
Oct 6, 2010
Messages
175
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.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
As a one-liner

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

finaljustice

Board Regular
Joined
Oct 6, 2010
Messages
175
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!
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,606
Messages
5,765,387
Members
425,281
Latest member
tmoreira001

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