Protecting multiple sheets
Hi,
Thiis uses an input box and provides a toggle. If a sheet is protected it
unprotects and vice versa
Sub ProtectAll()
Dim MyPass As String
MyPass = InputBox("Enter password for sheets", "Sheet Protection")
For x = 1 To Worksheets.Count
If Sheets(x).ProtectContents Then
Sheets(x).Unprotect Password:="MyPass"
Else
Sheets(x).Protect Password:="MyPass"
End If
Next
End Sub
Mike
"Robert Crandal" wrote:
If my workbook has 20 sheets, I would like to write a script
that protects all 20 sheets at once, but it only asks the user
for a password once. I basically want to display the same
dialog box that appears when someone presses the "Protect Sheet"
button.
Is this possible?
.
|