|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
各位大神,去年按照大神指点
写的如下代码
-第二部分可以直接运行,第一部分之前做到sheet 页面就是需要手动运行,但是我放一起后,设置打开自动运行,关闭自动运行,貌似第二个无法使用? ban
Private Sub Document_Close()
Cells.Select
Selection.Locked = False 'unlock
Selection.SpecialCells(xlCellTypeFormulas, 23).Select 'select cell with formula
Selection.FormulaHidden = False 'hidden Formula
Selection.Locked = True 'lock
ActiveSheet.Protect ("123")
End Sub
Private Sub Workbook_Open()
Worksheets("Aggregate Data").Protect Password:="123", DrawingObjects:=False, Contents:=True, Scenarios:=False, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowInsertingRows:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True, UserInterfaceonly:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Worksheets("Aggregate Data").EnableOutlining = True
End Sub
|
|