Function to Get Last Used Row From Excel Worksheet
By Scott Gall
Function which will get the last used cell in an excel worksheet.
This function will return the last used cell from a given worksheet.
Public Function GetLastCell(ws As Worksheet) As Range
Dim rngResult As Range
On Error GoTo ErrHandler
Set rngResult = ws.UsedRange.SpecialCells(xlCellTypeLastCell)
ExitPoint:
On Error GoTo 0
Exit Function
ErrHandler:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure GetLastRow"
GoTo ExitPoint
Resume
Resume Next
End Function
Function to Get Last Used Row From Excel Worksheet (507 Views)