Excel ActiveSheet.Protect
DrawingObjects:=False, 能編輯對象
Contents:=True, 內容
Scenarios:=False, 能編輯方案
AllowFormattingCells:=True, 格式化單元格
AllowFormattingColumns:=True, 格式化列
AllowFormattingRows:=True, 格式化行
AllowInsertingColumns:=True, 插入列
AllowInsertingRows:=True, 插入行
AllowInsertingHyperlinks:=True, 插入超鏈接
AllowDeletingColumns:=True, 刪除列
AllowDeletingRows:=True, 刪除行
AllowSorting:=True, 排序
AllowFiltering:=True, 篩選
AllowUsingPivotTables:=True 透視表
password:="123" 設置密碼
另:
ActiveSheet.EnableSelection = xlUnlockedCells 只選未鎖定單元格
ActiveSheet.EnableSelection = xlNoSelection 只選鎖定單元格
This property takes effect only when the worksheet is protected:
xlNoSelection prevents any selection on the sheet,
xlUnlockedCells allows only those cells whose Locked property is False to be selected,
and xlNoRestrictions allows any cell to be selected.
This example sets worksheet one so that nothing on it can be selected.
- With Worksheets(1)
- .EnableSelection = xlNoSelection
- .Protect Contents:=True, UserInterfaceOnly:=True
- End With
聯(lián)系客服