在受保护的表格上使用filter

我正在尝试使用filter标题行来使用户能够让他们select基于filter的数据。 但最终我保护了我的vba代码中的整个表格,以防止用户弄乱或更改数据。

关于如何启用filter和取消保护数据工作表的第一行的任何build议?

Worksheets("Data").Protect Password:="125393" Application.ScreenUpdating = True Application.DisplayAlerts = True 

尝试这个 :

 With ActiveSheet .Protect Password:="125393", AllowFiltering:=True .EnableSelection = xlUnlockedCells End With 

希望能帮助到你 !