32. VBA Tips - Turn Off Autofilter
Turn Off Autofilter
Turning off autofilter using VBA is easy and quick, but you need to know how it's done.
Here's some code to toggle the autofilter on and off:
Sub ToggleAutofilter() ' check if autofilter is currently off If ActiveSheet.FilterMode = False Then ' if it's off, turn it on, and filter on "Nick" Range("d5").AutoFilter Field:=1, Criteria1:="Nick" Else ' if it's on, turn it off Range("d5").AutoFilter End If End Sub
Training video on how to Turn Off Autofilter in Excel: