Forum Discussion
Kenneth Nelson
Jun 01, 2018Copper Contributor
Clear Filter with a button
I am only a "medium" excel guy, please be patient.... I have added a button to a spreadsheet that has columns that can be filtered. I have assigned the "clear" function/macro to the button. How...
Garys Student
Jun 10, 2018Copper Contributor
You can make the macro smart enough to look for the presence of a filter. If you want to show all data then:
Sub DisplayEverything()
If ActiveSheet.AutoFilterMode Then
ActiveSheet.ShowAllData
End If
End Sub
If you want to remove filtering completely then:
Sub RemoveTheFilter()
If ActiveSheet.AutoFilterMode Then
Cells.AutoFilter
End If
End Sub