VBA Find the last row on an Excel sheet

In order to speed up and make an automated process in Excel faster and more accurate, this short snippet of code is useful when placed in a VBA script. Excel databases rely on knowing where the last used row on a worksheet is, as well as VBA scripts that are designed to analyse or move data. By using the lastrow VBA you eliminate any extra work analysing unnecessary blank rows.

It can be used as a standlalone stored procedure which can be ‘called’ from within another macro or just placed within a current module.

It is safe to say that the majority, if not all of our projects contain this piece of code and when used with other snippets of code can be very powerful.

Feel free to ask us a question, or comment below…

Public Sub Find_Lastrow()
With ActiveSheet
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
End Sub

Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us