|
Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables)
但是事实上,如果需要在保护的工作表上使用自动筛选功能,需保证工作表处于自功筛选模式(必须先在工作表中显示自动筛选下拉箭头)。
以下代码允许在保护工作表后使用自动筛选功能。
Sub ProtectWithFiltering()
With ActiveSheet
If .AutoFilterMode = False Then '如果工作表不处于自动筛选模式
.Range("A1").AutoFilter '在指定区域切换自动筛选下拉箭头
End If
.Protect AllowFiltering:=True '保护工作表并允许使用自动筛选功能
End With
End Sub
GMT+8, 2024-4-26 09:13 , Processed in 0.025136 second(s), 9 queries , Gzip On, MemCache On.
Powered by Discuz! X3.4
© 1999-2023 Wooffice Inc.
沪公网安备 31011702000001号 沪ICP备11019229号-2
本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任! 本站特聘法律顾问:李志群律师