Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created December 22, 2016 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/f07ff7d2b6957748c69dd60bd290a199 to your computer and use it in GitHub Desktop.
Save ndthanh/f07ff7d2b6957748c69dd60bd290a199 to your computer and use it in GitHub Desktop.
Sub Range_Find_Method()
'Finds the last non-blank cell on a sheet/range.
Dim lRow As Long
Dim lCol As Long
    
    lRow = Cells.Find(What:="*", _
                    After:=Range("A1"), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
       SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
    
    MsgBox "Last Row: " & lRow
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment