Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Help Finding the Final Row

Sometimes setting a range to the .usedrange will reset the lastusedcell to what
you think it should be:

Option Explicit
Sub testme()

Dim DummyRng As Range

With Worksheets("sheet1")
Set DummyRng = .UsedRange
MsgBox .UsedRange.Rows(.UsedRange.Rows.Count).Row
End With

End Sub



chris wrote:

Then i guess this will do the trick!

RwCnt = ActiveSheet.UsedRange.Rows.Count
LastRow = ActiveSheet.UsedRange.Offset(x).Resize(1).Row - 1

----- Tom Ogilvy wrote: -----

goto a blank sheet.

enter data in A11, A12, A13

Now run you code:

? Rows(ActiveSheet.UsedRange.Rows.Count).Row
3

Doesn't quite give the correct answer.

You can't assume the usedrange always starts with the first row.
--
Regards,
Tom Ogilvy

"chris" wrote in message
...
try this:
Rows(ActiveSheet.UsedRange.Rows.Count).Row





--

Dave Peterson

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
final return! via135 Excel Worksheet Functions 5 January 11th 08 11:00 AM
Final day of month B Excel Worksheet Functions 3 July 25th 07 12:49 AM
My Final #DIV/0! that I'd like to say Goodbye to! Dan the Man[_2_] Excel Worksheet Functions 20 July 23rd 07 05:40 PM
Help for final touch up to my code Bimal[_3_] Excel Programming 3 February 5th 04 11:20 AM
Need final code tweak Phil Hageman Excel Programming 12 August 16th 03 08:53 PM


All times are GMT +1. The time now is 11:44 PM.

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"