Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If not entire rows, then
MsgBox Intersect(Selection.EntireRow, Columns(1)).Count Yes, that works fine and is **much** better than the code I posted! -- Rick (MVP - Excel) "keiji kounoike" <"kounoike A | T ma.Pikara.ne.jp" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting Highlighted Rows | Excel Programming | |||
Highlighted rows | Excel Discussion (Misc queries) | |||
Counting highlighted cells | Excel Discussion (Misc queries) | |||
Counting highlighted cells? | Excel Discussion (Misc queries) | |||
counting a highlighted cell | Excel Programming |