LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Locating end of used range- not returning expected value


I have code used to append new records (rows) on sheet 4. In the past, I use
the lastrow procedure (below, from this newsgroup) to find the last row
where I can add new data. however, in this particular case, it keeps trying
to add my data near the top of the worksheet. So I used the rows.count to
start troubleshooting, and got the correct value there even though the
lastrow procedure is still at the top of the sheet. I have saved, closed,
and re-opened the workbook, to no avail.

Any ideas why these two would return different values?

Thanks,
Keith
XP/XL2003

(misc code deleted)

My_LastRow = Sheet4.Cells.Find(What:="*", After:=[A1],
SearchDirection:=xlPrevious).Row
MsgBox Sheet4.UsedRange.Rows.Count
'returns a value of 77, which is accurate
MsgBox My_LastRow
'returns a value of 2, then after adding a record it returns a value
of 3.


 
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
Sumproduct not returning expected results Dos Equis Excel Worksheet Functions 8 January 4th 07 04:12 PM
Lookup returning one more than expected Victor Excel Worksheet Functions 3 November 23rd 06 11:40 PM
Using sum(1/countif....) not returning expected result Kent (thanks) Excel Worksheet Functions 10 May 11th 06 04:35 PM
Nested "if" not returning expected value Michael E W Excel Worksheet Functions 4 September 5th 05 04:50 AM
Returning expected dates London Excel Worksheet Functions 1 July 23rd 05 03:31 AM


All times are GMT +1. The time now is 04:57 AM.

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

About Us

"It's about Microsoft Excel"