ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last Row (https://www.excelbanter.com/excel-programming/291408-last-row.html)

Birdy

Last Row
 
How can i find the last row on a worksheet ?

on a worksheet the first row is row7 and i also want to find last row in a
formula.




Bob Phillips[_6_]

Last Row
 
Birdy,

I assume you mean the last row with data. This code finds the last row with
data in column A, and caters for embedded blank rows.

cLastRow = Worksheets("Sheet1").Cels(Rows.Count,"A").End(xlUp ).Row

If you want the first free row, just add 1.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Birdy" wrote in message
.nl...
How can i find the last row on a worksheet ?

on a worksheet the first row is row7 and i also want to find last row in a
formula.






Frank Kabel

Last Row
 
Hi
in VBA:
Dim rng as range
set rng = Cells(1,1).End(xldown)

--
Regards
Frank Kabel
Frankfurt, Germany

Birdy wrote:
How can i find the last row on a worksheet ?

on a worksheet the first row is row7 and i also want to find last row
in a formula.



Ron de Bruin

Last Row
 
Hi Birdy

If you can't check one column like in Bob's example then
for the last row with data on your worksheet you can use this

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
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Birdy" wrote in message .nl...
How can i find the last row on a worksheet ?

on a worksheet the first row is row7 and i also want to find last row in a
formula.







All times are GMT +1. The time now is 01:52 AM.

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