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
|