Select last row last col

Emm

Board Regular
Joined
Nov 29, 2004
Messages
165
Hi All,

I'm trying to select a range from B5: to last row : last column..
I can do it from B5 to a set column & last row...
But cant seem to get the varible on both row & col...

I am using this at present, but finding it misses if something down low in list with gaps:

Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

am trying this ...

LastRow = Range("B65536").End(xlUp).Row
LastCol = Range("IV5").End(xlLeft).Column
Range("B5" & LastCol & LastRow).Select
but has errors...

all help appreciated

thanks,

Keith
 
Thanks all...

It works because row 5 is my header row...... no data will be inserted if the col dosen't have a header...
and also Col B is my Item ID col ... so nothing will be entered without first putting the ID in...

works great
Picks up very last row of col B & last used Col in my header Row:5 from B onwards .. rather than IV backwards...

LastRow = Range("B" & Rows.Count).End(xlUp).Row
LastCol = Range("B5").End(xlToRight).Column
Range("B5", Cells(LastRow, LastCol)).Select



Thanks..

Keith
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Keith
IS there a risk, that at some point, there may be an empty cell in Row 5
If so, (xltoRight) will cause issues rather than using (xlToLeft)
(xltoLeft) is safer because it WILL find the correct Last Col
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

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