Following @Siddharth Rout comment above, using the Find
function is the safest way to get the last row.
StartLastRow = FindLastRow
If StartLastRow > 24 Then
.Cells(StartLastRow, 1).CurrentRegion.EntireRow.Delete
StartLastRow = FindLastRow
End If
'=======================================================================
Function FindLastRow() As Long
' This Function finds the last row in a worksheet, and returns the row number
Dim LastCell As Range
Set LastCell = Cells.Find(What:="*", After:=Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, _
searchorder:=xlByRows, searchdirection:=xlPrevious, MatchCase:=False)
If Not LastCell Is Nothing Then
FindLastRow = LastCell.Row
Else
MsgBox "Error! worksheet is empty", vbCritical
FindLastRow = -10000
End If
End Function