Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default fire macro on AutoFilter change

Hi all,
I have code to count the visible columns after making a selection w/ auto
filter and enter the count in a cell. What I can't seem to do is get it to
update after a selecting a different criteria w/ the autofilter. To update
the count I have to run it as a macro or attach it to a command button but
that kind of defeats my hope of keeping the user interface simple. I tried
change Worksheet_Change and Selection_Change without luck. I actually would
like some other things to fire (show a userform ) when a selection is made
so any help/direction would be great.

Of course all suggestions are always appreciated

Here's the simple code:
mycount = Range("A1").CurrentRegion.Columns(1).
SpecialCells(xlVisible).Count
Range("h1").Value = mycount

--
jeff

... I used to have a handle on life, but it broke.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default fire macro on AutoFilter change

Hi JeffP,

To return a dynamic filter record count, you could drop the macro and use
the built-in Subtotal worksheet function. Using the function argument of 3
(CountA), might suit your needs..

---
Regards,
Norman



"jeffP" wrote in message
...
Hi all,
I have code to count the visible columns after making a selection w/ auto
filter and enter the count in a cell. What I can't seem to do is get it to
update after a selecting a different criteria w/ the autofilter. To update
the count I have to run it as a macro or attach it to a command button but
that kind of defeats my hope of keeping the user interface simple. I
tried
change Worksheet_Change and Selection_Change without luck. I actually
would
like some other things to fire (show a userform ) when a selection is made
so any help/direction would be great.

Of course all suggestions are always appreciated

Here's the simple code:
mycount = Range("A1").CurrentRegion.Columns(1).
SpecialCells(xlVisible).Count
Range("h1").Value = mycount

--
jeff

.. I used to have a handle on life, but it broke.




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
Macro to fire upon opening file David P. Excel Discussion (Misc queries) 3 June 26th 08 09:12 PM
Fire Macro from Cell Change Slashman Excel Worksheet Functions 7 October 17th 06 04:08 AM
how to get onkey macro to fire while another macro is running Brian Murphy Excel Programming 8 August 25th 04 05:38 AM
Worksheet_Change event won't fire to execute Macro??? jpdill5 Excel Programming 2 February 13th 04 02:34 PM
How do I get Pivot filter change event to fire? Claude Excel Programming 4 August 15th 03 10:24 PM


All times are GMT +1. The time now is 03:53 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"