Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can someone tell me how to return the last row in a named range?
Thank you. Sprinks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
lastRow = Cells(Rows.Count, NamedRange.Columns(1)).End(xlUp).Row "Sprinks" wrote: Can someone tell me how to return the last row in a named range? Thank you. Sprinks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
JLGWhiz,
Thanks. "JLGWhiz" wrote: Try this lastRow = Cells(Rows.Count, NamedRange.Columns(1)).End(xlUp).Row "Sprinks" wrote: Can someone tell me how to return the last row in a named range? Thank you. Sprinks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this
Range("test").SpecialCells(xlCellTypeLastCell) -- Gary "Sprinks" wrote in message ... Can someone tell me how to return the last row in a named range? Thank you. Sprinks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry, you wanted the row, not the cell
i = Range("test").SpecialCells(xlCellTypeLastCell).Row -- Gary "Sprinks" wrote in message ... Can someone tell me how to return the last row in a named range? Thank you. Sprinks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 Sprinks wrote: Can someone tell me how to return the last row in a named range? Thank you. Sprinks -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to add, if not certain the 'last' area contains the 'lowest' row, would
need to loop each area. Regards, Peter T "Dave Peterson" wrote in message ... 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 Sprinks wrote: Can someone tell me how to return the last row in a named range? Thank you. Sprinks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
automatic range - named range give me circular reference... | Excel Discussion (Misc queries) | |||
Array as a "named range" - formula ok in cells, but error as "named range" | Excel Discussion (Misc queries) | |||
inserting a named range into new cells based on a named cell | Excel Discussion (Misc queries) | |||
Compare a selected Range with a Named range and select cells that do not exist | Excel Programming | |||
If any cell in named range = 8 then shade named range | Excel Programming |