Skip to content

Instantly share code, notes, and snippets.

@ijd65
Created July 25, 2013 00:29
Show Gist options
  • Save ijd65/6075837 to your computer and use it in GitHub Desktop.
Save ijd65/6075837 to your computer and use it in GitHub Desktop.
Function to find the last row of a worksheet
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment