Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created May 15, 2013 04:03
Show Gist options
  • Save stevehenderson/5581580 to your computer and use it in GitHub Desktop.
Save stevehenderson/5581580 to your computer and use it in GitHub Desktop.
A VBA helper function to find the final row of data on a worksheet (VBA, row, last, find)
'findFinalRow
'A helper function to find the final row of data on a worksheet
'
'To use, provide the name of the worksheet
'The function assumes the data starts in cell A1
'and will return the row number of the last row of data
'
'Author: Steve Henderson [email protected]
'
Function findFinalRow(sheetName As String)
'Set the Worksheet Name
Set WS = Worksheets(sheetName)
' Find the last row with data
findFinalRow = WS.Cells(Application.Rows.Count, 1).End(xlUp).row
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment