Count number of rows, where non relevant rows are hidden

P

Pieter

I want to count the number of rows i a worksheet. I have hidden the non
relevant rows in the sheet.
 
G

Gary''s Student

Enter and run this small sub:

Sub IAmTheCount()
Dim r As Range, c1 As Long, c2 As Long

For Each r In ActiveSheet.UsedRange.Rows
If r.Hidden Then
c1 = c1 + 1
Else
c2 = c2 + 1
End If
Next
MsgBox (c1 & " rows are hidden")
MsgBox (c2 & " rows are not hidden")
End Sub


It will report the number of hidden and un-hidden rows in your used range.
 
B

Bob Phillips

Use SUBTOTAL(2,rng)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Top