ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I count the number of rows selected? (https://www.excelbanter.com/excel-programming/426180-how-do-i-count-number-rows-selected.html)

stevem

How do I count the number of rows selected?
 
I want to find out how many rows are in my selected range after issuing these
lines:

Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell).Offset(0, -1)).Select

I don't know how to go from there. Is there a row property I can use to
capture the count of rows (something like countrows = selection.rows)? As
you can tell, I'm pretty much a novice at this. Thanks in advance,
S.


Roger Govier[_3_]

How do I count the number of rows selected?
 
Hi Steve

You've practically got it!!
countrows = Selection.Rows.Count
--
Regards
Roger Govier

"SteveM" wrote in message
...
I want to find out how many rows are in my selected range after issuing
these
lines:

Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell).Offset(0, -1)).Select

I don't know how to go from there. Is there a row property I can use to
capture the count of rows (something like countrows = selection.rows)? As
you can tell, I'm pretty much a novice at this. Thanks in advance,
S.


FSt1

How do I count the number of rows selected?
 
hi
Dim c As Long
c = Selection.Rows.Count
MsgBox c

regards
FSt1

"SteveM" wrote:

I want to find out how many rows are in my selected range after issuing these
lines:

Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell).Offset(0, -1)).Select

I don't know how to go from there. Is there a row property I can use to
capture the count of rows (something like countrows = selection.rows)? As
you can tell, I'm pretty much a novice at this. Thanks in advance,
S.


stevem

How do I count the number of rows selected?
 
Thank you Roger & FSt1 for the quick replies.

S.


All times are GMT +1. The time now is 03:59 PM.

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