保护表格,同时允许用户访问某些格式化功能

时间:2016-04-12 20:27:59

标签: vba excel-vba excel

在Workbook对象级别上有以下代码,但它不允许自动过滤或取消分组列。

Private Sub Workbook_Open()
    For Each ws In Sheets
        With ws
            .Protect Password:="xxxxxxxx", Userinterfaceonly:=True,      
            AllowFormattingColumns:=True, AllowFormattingRows:=True, _
            AllowFiltering:=True, AllowInsertingRows:=True,   
            AllowSorting:=True, AllowDeletingRows:=True
        End With

Next ws
End Sub

0 个答案:

没有答案