Counting records in a filtered list

  • Thread starter Thread starter plato
  • Start date Start date
P

plato

How can I count the number of records in a filtered list. The list gives me
the record number on the left so how can I count (other than manually) the
number of records that exist in that list?
 
To programmatically count the rows, you can use the code shown here:

http://www.contextures.com/xlautofilter03.html#Count

'====================
Sub CountVisRows()
'by Tom Ogilvy
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range

MsgBox rng.Columns(1). _
SpecialCells(xlVisible).Count - 1 _
& " of " & rng _
.Rows.Count - 1 & " Records"

End Sub
'===============================
 

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.

Ask a Question

Back
Top