Find Last Row, Column or Cell


Last Row or Column on WorkSheet


The macro 's below give you the last row or column number of the worksheet.
Note: The macros use the functions LastRow and LastCol below the macro
Tip: You can also use the sheet name instead of ActiveSheet like : Lr = LastRow(Sheets("YourSheet"))


Last used cell in one row or one column


The macro 's below give you the row or column number of the last cell with data in one row or one column.
Note: The code below will not work correct if the last row or column with data is hidden.


Last used cell row or column in a worksheet with xlCellTypeLastCell or UsedRange

Possible problems with xlCellTypeLastCell and UsedRange are:
The xlCellTypeLastCell or UsedRange will only re-set when you save (or save/close/reopen the file).
If cell formatting is changed it will not reset the last cell, clearing the data is not enough, you must delete the rows or columns first. See: http://www.contextures.com/xlfaqApp.html#Unused

So when using VBA you cannot rely on the macros below.
2/5/23
Web design by Will Woodgate