I'm new here and I'm looking to use Excel VBA to return the last used cell in a worksheet.
I'vv looked at Error in finding last used cell in Excel with VBA) but that didn't answer the two problems I have:
The
.Cells.Find(...).Row
method takes WAY too long in my code.My meaning of "last used cell" might be odd...the cell can be blank. I want to take the column that has the last used cell and pair it with the row that has the last used cell.
To explain: Assume a sheet is empty except for data in A1:C3
, D2
and B4
. (Exhibit 1)
The last cell I'm interested in is D4
because I want the last cell in the sheet that includes all data in the sheet.
Now that I've explained what I'm looking for, can anyone provide suggestions as to either
- how to make cells.find run faster or
- another credible method to find the "last cell" in a worksheet?
Thank you!
Find("*")
wouldn't catch), etc. Also, as @Comintern suggests, showing the code you have tried so far inclines people to help you more. – Ambie