I have a script which Highlights what are the columns which are filtered by changing the format of the column header. I found this is tampering my actual format of the report so I've to change the format back to its Original ever time I run this scrip. Can you please enrich the script to Display the Column number in a MsgBox instead of formatting the cells
I have posted this in another forum but did not get any reply yet..
https://chandoo.org/forum/threads/displ ... lls.52530/
Code:
Code: Select all
Option Explicit
Function DisplayFilter() As String
Dim i As Long
Dim ws As Worksheet
Set ws = ActiveSheet
If Not ws.FilterMode Then
DisplayFilter = "No Filter"
Exit Function
End If
For i = 1 To ws.AutoFilter.Filters.Count
If ws.AutoFilter.Filters(i).On Then
'ws.Cells(1, i).Interior.Color = vbRed '<<<< Need help here to show MsgBox'
ws.Cells(1, i).Font.Color = vbRed
ws.Cells(1, i).Font.Bold = True
End If
Next i
End Function
Sub ShowFilter()
Call DisplayFilter
End Sub