Solution for MS Excel 2003
Steps to do:
1) Add new module (do not change it name:
Module1
)
Option Explicit
Public ExcApp As MyApp
2) Add below code to
ThisWorkbook
module:
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set ExcApp = Nothing
End Sub
Private Sub Workbook_Open()
Set ExcApp = New MyApp
End Sub
3) Add new Class Module (change it name to:
MyApp
)
Option Explicit
Public WithEvents oApp As Application
Private Sub Class_Initialize()
Set oApp = Application
End Sub
Private Sub Class_Terminate()
Set oApp = Nothing
End Sub
Private Sub oApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim rng As Range, wsh As Worksheet, af As AutoFilter, f As Filter, i As Integer
Dim sTmp As String
On Error Resume Next
Set rng = Target
Set wsh = rng.Parent
Set af = wsh.AutoFilter
sTmp = "Filter range: " & af.Range.Address & vbCr
For Each f In af.Filters
i = i + 1
If f.On Then
sTmp = sTmp & "Filter on: " & af.Range.Cells(af.Range.Rows(1).Row, i).Address & vbCr
sTmp = sTmp & "Criteria 1: " & f.Criteria1 & vbCr
sTmp = sTmp & "Operator: " & f.Operator & vbCr
sTmp = sTmp & "Criteria 2: " & f.Criteria2
End If
Next
If sTmp<>"" Then MsgBox sTmp, vbInformation, "Filter information..."
Set f = Nothing
Set af = Nothing
Set wsh = Nothing
Set rng = Nothing
End Sub
4. Save workbook, close it and open it again with "
Enable macros
" option.
That's all!