G Guest Jul 3, 2007 #1 Can someone tell me how to return the last row in a named range? Thank you. Sprinks
G Gary Keramidas Jul 3, 2007 #4 sorry, you wanted the row, not the cell i = Range("test").SpecialCells(xlCellTypeLastCell).Row
G Guest Jul 3, 2007 #5 JLGWhiz, Thanks. JLGWhiz said: Try this lastRow = Cells(Rows.Count, NamedRange.Columns(1)).End(xlUp).Row Click to expand...
JLGWhiz, Thanks. JLGWhiz said: Try this lastRow = Cells(Rows.Count, NamedRange.Columns(1)).End(xlUp).Row Click to expand...
R Rick Rothstein \(MVP - VB\) Jul 3, 2007 #6 Can someone tell me how to return the last row in a named range? LastRow = Range("YourRangeName").Row + Range("YourRangeName").Count - 1 or, more compactly.... With Range("MyRange") LastRow = .Row + .Count - 1 End With Rick
Can someone tell me how to return the last row in a named range? LastRow = Range("YourRangeName").Row + Range("YourRangeName").Count - 1 or, more compactly.... With Range("MyRange") LastRow = .Row + .Count - 1 End With Rick
D Dave Peterson Jul 3, 2007 #7 One more (useful if there are multiple areas in the range): Option Explicit Sub testme() Dim myRng As Range Set myRng = Worksheets("Sheet1").Range("myname") With myRng With .Areas(.Areas.Count) MsgBox .Rows(.Rows.Count).Row End With End With End Sub
One more (useful if there are multiple areas in the range): Option Explicit Sub testme() Dim myRng As Range Set myRng = Worksheets("Sheet1").Range("myname") With myRng With .Areas(.Areas.Count) MsgBox .Rows(.Rows.Count).Row End With End With End Sub
P Peter T Jul 3, 2007 #8 Just to add, if not certain the 'last' area contains the 'lowest' row, would need to loop each area. Regards, Peter T
Just to add, if not certain the 'last' area contains the 'lowest' row, would need to loop each area. Regards, Peter T