对工作表批量保护/撤销保护

2016年3月30日14:09:16 发表评论 2
Sub 保护工作表()
 Dim sht As Worksheet
 Dim mySheet As String
 On Error Resume Next
 Application.ScreenUpdating = False
 For Each sht In Worksheets
 mySheet = sht.Name
 Sheets(mySheet).Protect Password:="1234", DrawingObjects:=True, Contents:=True, Scenarios:=True
 Next sht
 Application.ScreenUpdating = True
 End Sub
Sub 撤销工资表保护()
 Dim sht As Worksheet
 Dim mySheet As String
 On Error Resume Next
 Application.ScreenUpdating = False
 For Each sht In Worksheets
 sht.Unprotect "1234"
 Next sht
 Application.ScreenUpdating = True
 End Sub

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: