set range to bottom of sheet

R

ranswrt

I have the following code to set a range to the bottom of the sheet:

Set rng7 = Range(xcell.Offset(71, -2), xcell.Offset(65000, -2)).EntireRow

I know there is a way to set it to the very bottom of the sheet, but I can't
find it. How do I do this?
Thanks
 
G

Gary''s Student

Sub dural()
Set r = Range("A" & Rows.Count).EntireRow
r.Select
End Sub

will select the last row of a worksheet (both 2007 and prior versions)
 
P

Per Jessen

Hi

This will take set rng7 = last row with data, if all rows have data in
the "xcell" column.


LastRow = xcell.End(xlDown).Row ' I assume xCell is a range
Set rng7 = Rows(LastRow)

Regards,
Per
 
J

Jim Thomlinson

Set rng7 = Range(xcell.Offset(71, -2), cells(rows.count, "A")).EntireRow
 
Top