Excel 2013 VBA Clear All Filters macro

后端 未结 26 980
花落未央
花落未央 2020-11-27 16:26

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 comp

26条回答
  •  情话喂你
    2020-11-27 17:01

    I found this workaround to work pretty effectively. It basically removes autofilter from the table and then re-applies it, thus removing any previous filters. From my experience this is not prone to the error handling required with the other methods mentioned here.

    Set myTable = YOUR_SHEET.ListObjects("YourTableName")
    
    myTable.ShowAutoFilter = False
    myTable.ShowAutoFilter = True
    

提交回复
热议问题