> 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
news:OOwt$(E-Mail Removed)...
> 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
>>
|