Hi, I have two separate macros that work correctly with buttons in the quick access toolbar to execute each independently.
They are 'Protect All Worksheets' & 'Unprotect All Worksheets.'
Can someone please help me to add a password just to the code 'Unprotect All Worksheets' so that when its button is pressed a password must be entered before executing.
Also, does anyone have a code to automatically 'Protect All Worksheets' when closing a workbook? (No password is needed here.)
For some reason I cannot attach an example file from my work computer. Thanks in advance.
Sub Unprotect_All()
Dim ws As Worksheet
On Error Resume Next
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect Password:="wts"
Next ws
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
They are 'Protect All Worksheets' & 'Unprotect All Worksheets.'
Can someone please help me to add a password just to the code 'Unprotect All Worksheets' so that when its button is pressed a password must be entered before executing.
Also, does anyone have a code to automatically 'Protect All Worksheets' when closing a workbook? (No password is needed here.)
For some reason I cannot attach an example file from my work computer. Thanks in advance.
Sub Unprotect_All()
Dim ws As Worksheet
On Error Resume Next
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect Password:="wts"
Next ws
Application.ScreenUpdating = True
On Error GoTo 0
End Sub