Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default set range to bottom of sheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default set range to bottom of sheet

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

On 8 Sep., 20:19, ranswrt wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default set range to bottom of sheet

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)
--
Gary''s Student - gsnu200803


"ranswrt" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default set range to bottom of sheet

Try this formula...

Set rng7 = Rows(Rows.Count)

--
Rick (MVP - Excel)


"ranswrt" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default set range to bottom of sheet

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

--
HTH...

Jim Thomlinson


"ranswrt" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default set range to bottom of sheet

Thank You

"Jim Thomlinson" wrote:

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

--
HTH...

Jim Thomlinson


"ranswrt" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i see the headings at the bottom of the sheet sobhy New Users to Excel 1 July 30th 08 11:45 AM
VBA to find the bottom of a sheet [email protected] Excel Programming 1 June 27th 07 04:00 PM
VBA to find the bottom of a sheet [email protected] Excel Programming 0 June 26th 07 07:11 PM
bottom sheet tab disappears kaistix Excel Worksheet Functions 1 October 27th 06 07:14 PM
Calculate at the bottom of the sheet? AndyAnalyst Excel Discussion (Misc queries) 3 August 3rd 05 04:18 PM


All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"