#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Count Cells

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Count Cells

Have a look in HELP index for SUBTOTAL

--
Don Guillett
SalesAid Software

"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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count Cells

Another (works with a column where there may be missing values)

msgbox ActiveSheet.AutoFilter.Range.Columns(1) _
.SpecialCells(xlvisible).count-1

--
Regards,
Tom Ogilvy


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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to count#cells w/= value in other column and not count blank c aganoe Excel Worksheet Functions 4 April 9th 10 11:36 AM
count cells, then reset count when value in another cell changes Mitchell_Collen via OfficeKB.com Excel Worksheet Functions 4 February 20th 09 04:22 AM
Count cells with numbers and ignore cells with errors WonderingaboutMicrosoft Excel Discussion (Misc queries) 6 December 10th 06 08:03 PM
How do I count cells with text but ignore cells with spaces? Husker87 Excel Discussion (Misc queries) 2 September 21st 06 12:31 AM
HOW TO FORMATE CELLS TO COUNT CELLS WITH A FILL COLOR? Moore New Users to Excel 1 June 15th 05 06:41 PM


All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"