Function FindLastRow(c As Long) As Long 'Version: 1.001 'Purpose: This routine will find the last row in the spread sheet for the passed column ' c is the column to use to find the last row ' ignore's hidden rows '1.001 didn't work if formula set cell to a blank Dim prevRow As Long 'Go to the end On Error Resume Next Cells(Cells.Rows.Count, c).Select ' If Err <> 0 Then FindLastRow = 0 Exit Function End If Selection.End(xlUp).Select prevRow = 0 Do While Trim(ActiveCell.Text) = "" And ActiveCell.Row <> 1 ' Selection.End(xlUp).Select ActiveCell.Offset(-1, 0).Select If ActiveCell.Row = prevRow Then FindLastRow = ActiveCell.Row Exit Function Else prevRow = ActiveCell.Row End If Loop FindLastRow = ActiveCell.Row End Function |