[VBA] To check which column is filtered
Sub toFindFilteredColumn()
Dim i As Long
Dim myMessage As String
Dim myFlag As Boolean
myFlag = False
myMessage = "Below are the filtered Column:" & Chr(10)
With ActiveSheet.AutoFilter
On Error GoTo lineZeroFilter
For i = 1 To .Filters.Count
If .Filters(i).On Then
myFlag = True
myMessage = myMessage & "Column " & Split(Cells(1, i).Address, "$")(1) & " >>> " & Cells(1, i).Value & Chr(10)
End If
Next i
On Error GoTo 0
End With
If myFlag Then
MsgBox myMessage
End
End If
lineZeroFilter:
MsgBox "No Column is filtered"
End Sub
Source: ---
Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.