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

Datanology

3 thoughts on “VBA Find the last row on an Excel sheet

  1. Pingback: Colour alternative rows in a worksheet | Datanology

  2. Pingback: Import csv file and export in batches of 1000 | Datanology

  3. Pingback: VBA Delete blank rows | Datanology

Leave a Reply

Your email address will not be published. Required fields are marked *