This is the function l have been using for many years to return the last row.
It suits most of my needs as the parameters allow you to specify:
1. Workbook
2. Worksheet
3. Column
If you omit the column it will return the last row used in the specified sheet
Author: michael@excelexperts.co.uk
Function LR(Optional WorkbookName As String, Optional WorksheetName As String, Optional SpecificColumn As Variant) Dim wb As Workbook Dim ws As Worksheet If WorkbookName = vbNullString Then WorkbookName = ThisWorkbook.Name If WorksheetName = vbNullString Then WorksheetName = ActiveSheet.Name Set wb = Workbooks(WorkbookName) Set ws = wb.Worksheets(WorksheetName) On Error GoTo SheetEmpty If IsMissing(SpecificColumn) Then With ws LR = .Cells.Find("*", .Cells(1), xlFormulas, xlWhole, xlByRows, xlPrevious).Row End With Else With ws LR = .Cells(.Rows.Count, SpecificColumn).End(xlUp).Row If IsEmpty(.Cells(LR, SpecificColumn).Value) Then GoTo SheetEmpty End With End If Exit Function SheetEmpty: LR = 1 End Function