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
I'm guessing, then, that you will never have selections composed of
non-contiguous areas. For future consideration, you should really mention
such things in your questions when you ask them... the more information you
give about your set up and what you want to do, the better able we are to
give you solutions that do what you are looking for.
Yes, that works fine and is **much** better than the code I posted!
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.