Ich versuche, die Filterspalten Benutzern im Bericht anzuzeigen. Excel gibt ein anderes Symbol, aber für große nein. Spalten wird es gut sein, die Spalten in einer anderen Farbe wie blau zu färben.Es ist möglich, AutoFilter als Ereignis aufzufangen?
fand ich Code bei Is there a way to see which filters are active in Excel, other than just the funnel icons?
- Es funktioniert für mich, aber wie dieser Code fangen ohne Taste
- Sheetchange und Auswahländerung nicht funktionieren.
Code
Sub test()
Call markFilter(ActiveSheet)
End Sub
Sub markFilter(wks As Worksheet)
Dim lFilCol As Long
With wks
If .AutoFilterMode Then
For lFilCol = 1 To .AutoFilter.Filters.Count
'/ If filter is applied then mark the header as bold and font color as red
If .AutoFilter.Filters(lFilCol).On Then
.AutoFilter.Range.Columns(lFilCol).Cells(1, 1).Font.Color = vbRed
.AutoFilter.Range.Columns(lFilCol).Cells(1, 1).Font.Bold = True
Else
'/ No Filter. Column header font normal and black.
.AutoFilter.Range.Columns(lFilCol).Cells(1, 1).Font.Color = vbBlack
.AutoFilter.Range.Columns(lFilCol).Cells(1, 1).Font.Bold = False
End If
Next
Else
'/ No Filter at all. Column header font normal and black.
.UsedRange.Rows(1).Font.Color = vbBlack
.UsedRange.Rows(1).Font.Bold = False
End If
End With
End Sub
danken u !!! Ich versuche es. – teddy2
hat es funktioniert. Danke!! – teddy2
Schöne Art, über den Tellerrand hinaus zu denken. – Comintern