View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gaurav[_2_] Gaurav[_2_] is offline
external usenet poster
 
Posts: 207
Default Protecting Worksheets

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.


"biggrila06" wrote in message
...
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?