![]() |
Last used row problem
Through the valuable contributions of the MVPs and other members of this
group, I've learned a lot over the years- so thank you to everyone for your ongoing participation and assistance. One thing I picked up here was the following code to find the last used row: LastRow = Sheet1.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row This has worked for me for quite some time, but now I've run into a situation where it returns a higher row number than desired- in this case, the users of the workbook can manually delete (with the delete key, which actually just clears) rows, and the code above (again, some of the time) is returning a much later row than the last row that actually has any text in it. Conclusion- Excel requires some event or action to really think those rows are "clear". Other than recursively checking each cell in each row, is there something I can do to either (a) return the last blank row, or (b) force excel to clear any blank rows, so I get the desired row number? Thanks, Keith |
Last used row problem
There is information on this page Keith
http://www.rondebruin.nl/last.htm Note: if there is a space in a cell Excel will see this -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Keith R" wrote in message ... Through the valuable contributions of the MVPs and other members of this group, I've learned a lot over the years- so thank you to everyone for your ongoing participation and assistance. One thing I picked up here was the following code to find the last used row: LastRow = Sheet1.Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row This has worked for me for quite some time, but now I've run into a situation where it returns a higher row number than desired- in this case, the users of the workbook can manually delete (with the delete key, which actually just clears) rows, and the code above (again, some of the time) is returning a much later row than the last row that actually has any text in it. Conclusion- Excel requires some event or action to really think those rows are "clear". Other than recursively checking each cell in each row, is there something I can do to either (a) return the last blank row, or (b) force excel to clear any blank rows, so I get the desired row number? Thanks, Keith |
All times are GMT +1. The time now is 06:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com