tags:

views:

23

answers:

1

I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups of rows).

I would like to get the count of all the rows in that range.

However, range.Count gives me the count of all the cells (50,000~) and range.Rows.Count only return 1 - the count of all the rows in the first group. How do I get the count of all the rows

Thanks

+1  A: 
Dim rowCount As Long
Dim ctr As Long

'You could use your range variable in place of Selection below
For ctr = 1 To Selection.Areas.Count
    rowCount = rowCount + Selection.Areas(ctr).Rows.Count
Next
Debug.Print rowCount
shahkalpesh