LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default Counting Highlighted Rows

If highlighting rows means selecting entire rows, I think this would be
enough.

MsgBox Intersect(Selection, Columns(1)).Count

If not entire rows, then

MsgBox Intersect(Selection.EntireRow, Columns(1)).Count

Keiji

Rick Rothstein wrote:
By "highlighting", do you mean "selecting"? If so, then give this macro
a try (it will handle both contiguous and non contiguous selections)...

Sub CountRowsInSelection()
Dim A As Range, U As Range
For Each A In Selection.Areas
If U Is Nothing Then
Set U = A.EntireRow
Else
Set U = Union(U, A.EntireRow)
End If
Next
MsgBox Intersect(U, Columns(1)).Count
End Sub

 
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
Counting Highlighted Rows Phil H[_2_] Excel Programming 1 November 17th 09 07:11 PM
Highlighted rows Reyes Excel Discussion (Misc queries) 2 November 13th 08 06:58 PM
Counting highlighted cells Kassie Excel Discussion (Misc queries) 2 May 8th 08 04:50 PM
Counting highlighted cells? Josh - Westfield Australia Excel Discussion (Misc queries) 2 April 20th 05 09:20 AM
counting a highlighted cell Dragonstear Excel Programming 1 October 17th 03 03:44 AM


All times are GMT +1. The time now is 07:05 AM.

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"