Thread: Count Cells
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ture Magnusson Ture Magnusson is offline
external usenet poster
 
Posts: 21
Default Count Cells

Pedro,

Will this help? Note that this procedure assumes that the first
column of the filtered range doesn't contain any blank cells.

Sub ShowNumberOfRecords()
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range.Columns(1)
MsgBox Application.WorksheetFunction.Subtotal(3, rng) - 1
End Sub

--
Ture Magnusson
Microsoft MVP - Excel
Karlstad, Sweden

"Pedro" wrote in message
...
Hi
If when I apply a Filter it gives me 5 records, or 7, or whatever number

of
records.
What code should I write in order to give me the number of records (rows)

,
5, 7 whatever

thanks
Pedro