VBA: Find the last row used
Do you have to run a loop down a sheet but don’t know where the data stops? ActiveSheet.UsedRange.Rows.Count might help.
1. Put this in a module
Sub LastRow() Dim LastRow As Integer LastRow = ActiveSheet.UsedRange.Rows.Count MsgBox LastRow End Sub
Can't get the tutorial to work for you? Need help with your code?
Get answers right away at our AE Excel Support Forums!
Get answers right away at our AE Excel Support Forums!



Works, but, if you free the last cell, UsedRange.Rows.Count does not change dynamically.