I was goggling for the code to find Autofilter and many websites (including reputable ones) wrote that I can use AutoFilterMode to check for the existence of AutoFilter in a worksheet. But when I tried to run the code, it fails to detect the Autofilter function. The code is

With ActiveSheet
If .AutoFilterMode = True And .FilterMode = True Then
MsgBox “They are visible and in use”
ElseIf .AutoFilterMode = True Then
MsgBox “They are visible but not in use”
MsgBox “They are not visible or in use”
End If
End With

I was working on Excel 2010. After searching further, I finally found the code in the blog listed below that works, at least for Excel 2010.


The code that he published is

If Not ActiveSheet.AutoFilter Is Nothing Then
‘Autofilter mode is on
End If


Leave a Reply