Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to "Capture" Records Found Number During AutoFilter

When I do an AutoFilter, the number of records found is usually displayed in
the lower left-hand corner of the window. Say the filter result is 5 of 20
records found. How can I "capture" the 5 and 20 number values in VBA? I
want to use the values elsewhere in a macro. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to "Capture" Records Found Number During AutoFilter

Option Explicit
Sub testme()

Dim TotalRows As Long
Dim VisibleRows As Long

With ActiveSheet.AutoFilter.Range.Columns(1)
'subtract the header from both
TotalRows = .Cells.Count - 1
VisibleRows = .Cells.SpecialCells(xlCellTypeVisible).Count - 1
End With

MsgBox VisibleRows & " of " & TotalRows & " records found"
End Sub

Paputxi wrote:

When I do an AutoFilter, the number of records found is usually displayed in
the lower left-hand corner of the window. Say the filter result is 5 of 20
records found. How can I "capture" the 5 and 20 number values in VBA? I
want to use the values elsewhere in a macro. Thanks in advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to "Capture" Records Found Number During AutoFilter

Dim tot as Long, vis as Long
tot = Activesheet.Autofilter.Range.Rows.count -1
vis = Activesheet.Autofilter.Range.Columns(1).Specialcel ls(xlVisible) - 1
msgbox vis & " of " & tot

--
Regards,
Tom Ogilvy


"Paputxi" wrote in message
...
When I do an AutoFilter, the number of records found is usually displayed

in
the lower left-hand corner of the window. Say the filter result is 5 of

20
records found. How can I "capture" the 5 and 20 number values in VBA? I
want to use the values elsewhere in a macro. Thanks in advance.



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 do I view..."no. of records found"... when I filter. David O. Excel Discussion (Misc queries) 3 September 14th 09 09:21 PM
Difficulty "countif"-ing number of "L1" or "L2" on an autofiltered pmdoherty Excel Worksheet Functions 4 February 6th 09 11:23 AM
retrieving "Records Found" asmenut Excel Programming 2 November 3rd 05 09:15 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 11:51 AM.

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"