|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 所有表格公式加密()
On Error Resume Next
Call 所有表格解密
Dim Sh As Worksheet
For Each Sh In Worksheets
With Sh
.Activate
.Cells.Locked = False
Cells.Select
If Selection.HasFormula = False Then GoTo line
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Selection.Locked = True
Selection.FormulaHidden = True
Rem 下列第二参数为允许编辑VBA,第三参数为允许自动筛选,第四参数为允许调用透视表
.protect Password:="111", userinterfaceonly:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
End With
line:
Next Sh
End Sub
Sub 单张表格公式加密()
With ActiveSheet
.Cells.Locked = False
Cells.Select
If Selection.HasFormula = False Then Exit Sub
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Selection.Locked = True
Selection.FormulaHidden = True
Rem 下列第二参数为允许编辑VBA,第三参数为允许自动筛选,第四参数为允许调用透视表
.protect Password:="111", userinterfaceonly:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
End With
End Sub |
|