It seems older macros are not working. I have proper securtiy set to run VBA macros but when I have tried a few methods for clearing ALL filters on a worksheet, I get a compile error.
Here is what I have tried:
Sub AutoFilter_Remove() 'This macro removes any filtering in order to display all of the data but it does not remove the filter arrows ActiveSheet.ShowAllData End Sub
I have buttons on the sheets to clear all filters for ease of use for users since the sheets has a lot of columns that have filters on them.
To clear filters on a single column we use the AutoFilter method. We only reference the Field parameter and set the value to the number of the column we want to clear. The Field is the column number of the range the filters are applied to, NOT the column number of the worksheet.
Re: Button for reset all filters Excel already has a button to turn on/off the Filter, you can find it in the Sort & Filter group under the Data tab. If you have some filters and you want to clear them all, you can go and click this button twice to turn the filters off and then turn it on, this is will clear them all.
If you want to completely remove filters, go to the Data tab and click the Filter button, or use the keyboard shortcut Alt+D+F+F.
Try this:
If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
ShowAllData will throw an error if a filter isn't currently applied. This will work:
Sub ResetFilters() On Error Resume Next ActiveSheet.ShowAllData End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With