Last active
August 29, 2015 14:17
-
-
Save jaykilleen/cce6afd13d2bd2a8c70b to your computer and use it in GitHub Desktop.
Excel VBA Find Last Row as get_last_row function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Just copy the function below into a new module | |
'I usually call this module 'functions' | |
'You can then call anywhere in your scripts `get_last_row(ThisWorkbook.Sheets("sheet_1"), 1) | |
'It will then find you the last row of column A | |
`Change the interger for the second argument to use any other column | |
`checkout https://gist.github.com/jaykilleen/892d0f0eed87b9f8e6b0 for other functions that I like to add into my 'functions' module. | |
Option Explicit | |
Function get_last_row(sheetname As String, column_number As Integer) As Long | |
get_last_row = Sheets(sheetname).Cells(Rows.Count, column_number).End(xlUp).row | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment