ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   retrieving "Records Found" (https://www.excelbanter.com/excel-programming/344682-retrieving-records-found.html)

asmenut

retrieving "Records Found"
 
When using VBA to access the Autofilter method, is there a way to access the
# of Records found?

Tom Ogilvy

retrieving "Records Found"
 
Not really (since there is no guarantee it will be in the status bar), but
it is easy to get

dim rng as Range
set rng = Activesheet.autofilter.Range.columns(1).Cells

set rng = rng.specialcells(xlvisible)

msgbox "Records found: " & rng.count - 1

you subtract 1, because rng would include the header row.

--
Regards,
Tom Ogilvy




"asmenut" wrote in message
...
When using VBA to access the Autofilter method, is there a way to access

the
# of Records found?




asmenut

retrieving "Records Found"
 
THANK YOU.

I knew there had to be a way to get the information I needed. I just needed
to submit the question the right way.

You guys are the best. Microsoft chose their MVP's very well

"Tom Ogilvy" wrote:

Not really (since there is no guarantee it will be in the status bar), but
it is easy to get

dim rng as Range
set rng = Activesheet.autofilter.Range.columns(1).Cells

set rng = rng.specialcells(xlvisible)

msgbox "Records found: " & rng.count - 1

you subtract 1, because rng would include the header row.

--
Regards,
Tom Ogilvy




"asmenut" wrote in message
...
When using VBA to access the Autofilter method, is there a way to access

the
# of Records found?






All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com