ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   on which column is the filter active? (https://www.excelbanter.com/excel-programming/369227-column-filter-active.html)

Alfonso[_2_]

on which column is the filter active?
 
How do I identify the column on which a filter is active in an Excel sheet?

Alfonso



[email protected]

on which column is the filter active?
 
Hi
Try this:
Sub tester()
Dim myFilter As Filter
Dim Filtercolumn As Integer

Filtercolumn = 0
With Worksheets(1)
If .AutoFilterMode Then
For Each myFilter In .AutoFilter.Filters
Filtercolumn = Filtercolumn + 1
If myFilter.On Then
MsgBox Filtercolumn
End If
Next myFilter
End If
End With
End Sub

regards
Paul
Alfonso wrote:
How do I identify the column on which a filter is active in an Excel sheet?

Alfonso



Alfonso[_2_]

on which column is the filter active?
 
GREAT!!! thanks!

wrote in message
ups.com...
Hi
Try this:
Sub tester()
Dim myFilter As Filter
Dim Filtercolumn As Integer

Filtercolumn = 0
With Worksheets(1)
If .AutoFilterMode Then
For Each myFilter In .AutoFilter.Filters
Filtercolumn = Filtercolumn + 1
If myFilter.On Then
MsgBox Filtercolumn
End If
Next myFilter
End If
End With
End Sub

regards
Paul
Alfonso wrote:
How do I identify the column on which a filter is active in an Excel
sheet?

Alfonso





MakeLei

on which column is the filter active?
 
Hi,
How could I use the value in the filter heading cell instead of Filtercolumn
number?

BR
Makelei

" wrote:

Hi
Try this:
Sub tester()
Dim myFilter As Filter
Dim Filtercolumn As Integer

Filtercolumn = 0
With Worksheets(1)
If .AutoFilterMode Then
For Each myFilter In .AutoFilter.Filters
Filtercolumn = Filtercolumn + 1
If myFilter.On Then
MsgBox Filtercolumn
End If
Next myFilter
End If
End With
End Sub

regards
Paul
Alfonso wrote:
How do I identify the column on which a filter is active in an Excel sheet?

Alfonso





All times are GMT +1. The time now is 02:02 AM.

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