Protecting Worksheets

B

biggrila06

Is there a way to protect and unprotect several worksheets, in the same
workbookat the same time? Or do you have to do each one individually?
 
G

Gaurav

Right click on the first sheet tab, View Code, paste the following code
there.

Sub Protect_Selected_Sheets()
Set MySheets = ActiveWindow.SelectedSheets
For Each WS In MySheets
WS.Select
WS.Protect Password:="password"
Next WS
End Sub

Now Save and close

Now Right click on the second sheet tab, View Code, paste the following code
there.

Sub Protect_Selected_Sheets()
Set MySheets = ActiveWindow.SelectedSheets
For Each WS In MySheets
WS.Select
WS.Unprotect Password:="password"
Next WS
End Sub

Save and Close.

Now assign shortcut keys to the macros. for example to protect, CTRL+M and
to unprotect, CTRL+J.

Whenever you want to protect all the sheets, right click on any of the sheet
tabs, click on 'Select all sheets' and press CTRL+M. Same is to unprotect
just press CTRL+J.
 
Top