View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Count of rows - discontiguous selection

Dim myRng As Range
Set myRng = Intersect(ActiveSheet.Columns(1), Selection.EntireRow)
MsgBox myRng.Cells.Count

If the discontiguous areas could be in overlapping rows, this may not give you
want you want.

A1:A13, B2:B5, C12:C13

would give 13.



xp wrote:

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...


--

Dave Peterson