ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting a row number of the last row? (https://www.excelbanter.com/excel-programming/294927-getting-row-number-last-row.html)

andycharger[_22_]

Getting a row number of the last row?
 
I need to get the row number of my last row in a selection dynamically

How do I get this?


Thanks

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


Frank Kabel

Getting a row number of the last row?
 
Hi
if you want the last row in your current selection try
sub foo()
dim rng as range
dim lastrow as long
set rng = selection
lastrow = rng.row+rng.rows.count-1
msgbox lastrow
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


I need to get the row number of my last row in a selection

dynamically

How do I get this?


Thanks!


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



patrick molloy

Getting a row number of the last row?
 
if rTarget is your range, then
rTarget.Row is the first row,
rTarget.Rows.Count is the number of rows,
thus then last row is
with rTarget
lastrow = .Row + .Rows.Count -1
end with

Patrick Molloy
Microsoft Excel MVP
------------------
I feel Great!

-----Original Message-----
I need to get the row number of my last row in a

selection dynamically

How do I get this?


Thanks!


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

.


Tom Ogilvy

Getting a row number of the last row?
 
selection.rows(selection.rows.count).row

--
Regards,
Tom Ogilvy

"andycharger " wrote in message
...
I need to get the row number of my last row in a selection dynamically

How do I get this?


Thanks!


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




Robert McCurdy

Getting a row number of the last row?
 
MsgBox Selection.Rows.Count + Selection.Row - 1

Just in case you are looking for the last row of your selection on your workbook.


Regards Robert

"andycharger " wrote in message ...
I need to get the row number of my last row in a selection dynamically

How do I get this?


Thanks!


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



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 09/04/2004




All times are GMT +1. The time now is 03:17 AM.

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