View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Count of rows - discontiguous selection

Try this code...

Dim R As Range, TotalRows As Long
......
......
For Each R In Selection.Areas
TotalRows = TotalRows + R.Rows.Count
Next
MsgBox "That selection has " & TotalRows & " rows in it."

--
Rick (MVP - Excel)


"xp" wrote in message
...
Hi,

I need a code that will count the number of rows in a selection; BUT, the
selection has multiple sets of discontiguous ranges of cells each with a
various number of rows.

I thought, Selection.Rows.Count would do it, but it doesn't...

Thanks for the help...