Sub 一次給所有工作表添加保護()
For X = 1 To Sheets.Count
Sheets(X).Protect Password:=123
Next X
End Sub作者: p223941 時間: 2016-1-29 14:24
Dim sht As Worksheet
myNum = Application.InputBox("請輸入密碼")
If myNum = "123" Then
For Each sht In Worksheets
sht.Unprotect Password:="123"
Next
Else
MsgBox "密碼錯誤"
End If