Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default How can I detect change to Autofilter selection

Is there a way to detect a change in a sheet's Autofilter Selection?

ie... when I change Autofilter for column 5, I need to get what the new
values are for Title, Criteria1 etc....

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default How can I detect change to Autofilter selection

hi, Mike !

Is there a way to detect a change in a sheet's Autofilter Selection?
ie... when I change Autofilter for column 5, I need to get what the new values are for Title, Criteria1 etc...


following is an "ancient" procedure I used in the filtering worksheet code module (_calculate event)
to put a formula in cell [E2] and linked to a textbox (shape drawing)

hth,
hector.

Private Sub Worksheet_Calculate()
Dim myFormula As String, nFilter As Integer, Filtered As Integer, Filtering As String
If Not Me.AutoFilterMode Then Exit Sub
Application.ScreenUpdating = False
myFormula = "=""Filtering by:"""
With Range(Me.AutoFilter.Range.Address)
For nFilter = 1 To .Columns.Count
With .Cells(1, nFilter)
If Me.AutoFilter.Filters(nFilter).On Then
Filtered = Filtered + 1
Filtering = CStr(.Value)
With Me.AutoFilter.Filters(nFilter)
myFormula = myFormula & "&" & _
"Char(10)" & "&""" & Filtered & ".- " & Filtering & ". Criteria " & .Criteria1
If .Operator = xlAnd Then myFormula = myFormula & " AND 2nd criteria " & .Criteria2
If .Operator = xlOr Then myFormula = myFormula & " OR 2nd criteria " & .Criteria2
myFormula = myFormula & """"
End With
End If
End With
Next
End With
If Filtered = 0 Then myFormula = _
"=""Actually""" & "&" & "Char(10)" & "&" & """There is NO active filters !!!"""
Me.Range("e2").Formula = myFormula
End Sub


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
Detect Autofilter Change Event Alan Z. Scharf Excel Programming 2 March 13th 09 10:01 PM
AutoFilter Selection to Change Page Header Darrell Lankford Excel Programming 0 April 29th 08 06:38 PM
How to detect last row of Selection? [email protected] Excel Programming 2 April 10th 06 05:56 AM
Autofilter.Selection - After Change Event??? Paul M.[_2_] Excel Programming 0 August 15th 03 05:16 AM
How can I detect an AutoFilter when the Criteria isnt Met Frederick Excel Programming 2 August 12th 03 02:43 PM


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