ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   bottom row (https://www.excelbanter.com/excel-programming/298083-bottom-row.html)

Mike Archer[_2_]

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

TIA
Mike

Ron de Bruin

bottom row
 
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






--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mike Archer" wrote in message ...
How would you find the last non-empty row on a worksheet
without regard to a specific column?

TIA
Mike




BrianB

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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com