Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do i know how many rows has been selected?

When i used the CTRL and SHIFT key to multiple select some rows, ex: Row 1,
5, 7,11. How do i to check how many rows has been selected? like return 4.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do i know how many rows has been selected?

Hi OKLover,

Try:

Sub Tester1()
Dim rng As Range, Ar As Range, rw As Range
Dim iCtr As Long

Set rng = Selection

For Each Ar In rng.Areas
For Each rw In Ar.Rows
iCtr = iCtr + 1
Next rw
Next Ar

MsgBox "There are " & iCtr & " rows in the selection"

End Sub

---
Regards,
Norman



"OKLover" wrote in message
...
When i used the CTRL and SHIFT key to multiple select some rows, ex: Row
1, 5, 7,11. How do i to check how many rows has been selected? like return
4.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default How do i know how many rows has been selected?

One option if you do in fact have entire rows selected:

N = Intersect(Selection, Columns(1)).Cells.Count
or to be safe:
N = Intersect(Selection.EntireRow, Columns(1)).Cells.Count

HTH
--
Dana DeLouis
Win XP & Office 2003


"OKLover" wrote in message
...
When i used the CTRL and SHIFT key to multiple select some rows, ex: Row
1, 5, 7,11. How do i to check how many rows has been selected? like return
4.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do i know how many rows has been selected?

Wonderful! you are so COOOOOOOOL ~


"Dana DeLouis" bl...
One option if you do in fact have entire rows selected:

N = Intersect(Selection, Columns(1)).Cells.Count
or to be safe:
N = Intersect(Selection.EntireRow, Columns(1)).Cells.Count

HTH
--
Dana DeLouis
Win XP & Office 2003


"OKLover" wrote in message
...
When i used the CTRL and SHIFT key to multiple select some rows, ex: Row
1, 5, 7,11. How do i to check how many rows has been selected? like
return 4.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
More than selected rows being highlighted RLD Excel Discussion (Misc queries) 2 March 17th 10 07:03 AM
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
How many rows have I selected ? Paul Ho Excel Worksheet Functions 6 November 26th 05 02:43 PM
how many rows did I selected Paul Ho Excel Worksheet Functions 1 November 26th 05 06:59 AM
Delete non-selected rows SparePersn Excel Programming 2 December 21st 04 02:57 PM


All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"