Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Last Row of Selection
Hello,
Is there a different way of getting the last row of a selection? The first row is selection.rows(1).row, but I can't get the last row without counting rows and subtracting one. lastrow = selection.rows(1).row+selection.rows.count-1 Thanks. Bill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Last Row of Selection
What is wrong with that way? You do't need rows(1), just
lastrow = selection.row+selection.rows.count-1 An alternative is LastRow = rng(rng.Count).Row -- HTH Bob Phillips "Bill" wrote in message link.net... Hello, Is there a different way of getting the last row of a selection? The first row is selection.rows(1).row, but I can't get the last row without counting rows and subtracting one. lastrow = selection.rows(1).row+selection.rows.count-1 Thanks. Bill |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Last Row of Selection
LastRow = Selection.Rows(Selection.Rows.Count).Row
Not much prettier and much more difficult to read. Mike F "Bill" wrote in message link.net... Hello, Is there a different way of getting the last row of a selection? The first row is selection.rows(1).row, but I can't get the last row without counting rows and subtracting one. lastrow = selection.rows(1).row+selection.rows.count-1 Thanks. Bill |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Last Row of Selection
Maybe easier to read:
with selection LastRow = .Rows(.Rows.Count).Row end with and I like: with selection LastRow = .cells(.cells.Count).Row end with (just to be different!) Mike Fogleman wrote: LastRow = Selection.Rows(Selection.Rows.Count).Row Not much prettier and much more difficult to read. Mike F "Bill" wrote in message link.net... Hello, Is there a different way of getting the last row of a selection? The first row is selection.rows(1).row, but I can't get the last row without counting rows and subtracting one. lastrow = selection.rows(1).row+selection.rows.count-1 Thanks. Bill -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Limiting selection in a cell AND linking that selection to a list | Excel Discussion (Misc queries) | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
Identifying a selection of a selection of a range | Excel Worksheet Functions | |||
Object Type of a selection... counting rows in a selection | Excel Programming | |||
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. | Excel Programming |