Created
July 27, 2011 13:41
-
-
Save hoffstein/1109374 to your computer and use it in GitHub Desktop.
Excel find last row
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
Function FindLastRow(Optional sheetToSearch As Worksheet) As Long | |
If sheetToSearch Is Nothing Then Set sheetToSearch = ActiveSheet | |
On Error GoTo handler | |
FindLastRow = sheetToSearch.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row | |
Exit Function | |
handler: | |
FindLastRow = 1 ' No data on sheet | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment