Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Trapping the AutoFilter Event

I have a worksheet that has the AutoFilter enabled.

Is there a method to trap when the user selects to perform the AutoFilter?

I want to carry out a few steps when they do.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Trapping the AutoFilter Event

Hi John

Try this from should get you what you want. Need to change the sheet
name and insert your actions.

Take care

Marcus

Sub autofil()

With Worksheets("Sheet1")
If .AutoFilterMode Then
'Your code here
End If
End With

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Trapping the AutoFilter Event

I don't see how that would work...if the user performs a AutoFilter action,
what would trigger the Sub AutoFil procedure?


"marcus" wrote:

Hi John

Try this from should get you what you want. Need to change the sheet
name and insert your actions.

Take care

Marcus

Sub autofil()

With Worksheets("Sheet1")
If .AutoFilterMode Then
'Your code here
End If
End With

End Sub
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Trapping the AutoFilter Event

Sorry misread your post.

This from the msdn website

"One of the limiting aspects of using the AutoFilter feature in a
business solution is that it has no directly associated event in the
Excel object model. In other words, when a filter is applied or
changed, by a user or programmatically, there is no explicit event for
the activity."

The article goes on to explain a way to capture the autofilter event
with the use of smart tags. Will let you get your head around it. It
is worth reading.

http://msdn.microsoft.com/en-us/libr...ffice.10).aspx

Take care

Marcus
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Trapping the AutoFilter Event

You can use the Calculate Event to trap AutoFilter changes. For example:

=SUBTOTAL(2,A:A)

will give the count of visible cells in column A. Excel re-calculates this
whenever the AutoFilter is adjusted and the event gets triggered.
--
Gary''s Student - gsnu200909


"PosseJohn" wrote:

I have a worksheet that has the AutoFilter enabled.

Is there a method to trap when the user selects to perform the AutoFilter?

I want to carry out a few steps when they do.

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
Trapping SheetChange Event in COM add-in Yeolhyun Kwon Excel Programming 0 January 5th 09 07:04 AM
trapping charts event PLP Charts and Charting in Excel 2 June 21st 07 01:18 AM
Trapping Add Shape Event jgb103 Excel Programming 0 May 15th 06 03:11 PM
Error trapping for the Form_Activate() event [email protected] Excel Programming 4 January 3rd 06 06:11 AM
Trapping Excel Close event Bob J[_2_] Excel Programming 3 December 5th 03 11:56 PM


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