Excel 2013 VBA 清除所有过滤器宏 [英] Excel 2013 VBA Clear All Filters macro

查看:61
本文介绍了Excel 2013 VBA 清除所有过滤器宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎较旧的宏不起作用.我有适当的安全设置来运行 VBA 宏,但是当我尝试了几种清除工作表上所有过滤器的方法时,出现编译错误.

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.

这是我尝试过的:

<代码>子 AutoFilter_Remove()'此宏删除任何过滤以显示所有数据,但它不会删除过滤箭头ActiveSheet.ShowAllData结束子


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.

推荐答案

如果工作表已经有过滤器,则:

Sub Macro1()
    Cells.AutoFilter
End Sub

删除.

这篇关于Excel 2013 VBA 清除所有过滤器宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆