Protect every worksheet in a workbook with a Password
Dim X As Worksheet
Sonder = InputBox("Enter the Password to protect the worksheets", "Protect worksheets")
For Each X In ActiveWorkbook.Worksheets
Unprotect every protected worksheet in a workbook
Dim Pass As String
Dim Y As Worksheet
Pass = InputBox("Enter the Password to Unprotect the worksheets", "UnProtect worksheets")
If Pass = Sonder Then
For Each Y In ActiveWorkbook.Worksheets
MsgBox "Incorrect Password"
How to use codes shared here?