bottom row

M

Mike Archer

How would you find the last non-empty row on a worksheet
without regard to a specific column?

TIA
Mike
 
R

Ron de Bruin

Hi Mike

You can use this example that use a function

Sub test()
MsgBox LastRow(ActiveSheet)
End Sub

Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
 
B

BrianB

'-----------------------------------
Sub RealLastRow()
Set foundcell = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows)
MsgBox (foundcell.Row + 1)
End Sub
'----------------------------------
 
Top