#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default MS Excel

Can we protact two or more sheets simultaneously using one password.
Similarly can we unprotect two or more sheets in single command having one
password.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 329
Default MS Excel

Hi Garg Swadesh,

No, they have to be done one at a time, but you could use a macro to automate the processes, thus requiring the user to input the
password only once. For example, the following 'ProtectAllSheets' code protects all unprotected sheets, while the
'UnprotectAllSheets' code does the opposite:

Sub ProtectAllSheets()
Dim wkSheet As Worksheet
For Each wkSheet In ActiveWorkbook.Worksheets
If wkSheet.ProtectContents < True Then
wkSheet.Protect Password:=InputBox("Please enter the password")
End If
Next wkSheet
End Sub

Sub UnprotectAllSheets()
Dim wkSheet As Worksheet
For Each wkSheet In ActiveWorkbook.Worksheets
If wkSheet.ProtectContents = True Then
wkSheet.Unprotect Password:=InputBox("Please enter the password")
End If
Next wkSheet
End Sub


Cheers

--
macropod
[MVP - Microsoft Word]
-------------------------

"Garg Swadesh" <Garg wrote in message ...
Can we protact two or more sheets simultaneously using one password.
Similarly can we unprotect two or more sheets in single command having one
password.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default MS Excel


use a looping macro to do either

--
Don Guillett
SalesAid Software

"Garg Swadesh" <Garg
wrote in message
...
Can we protact two or more sheets simultaneously using one password.
Similarly can we unprotect two or more sheets in single command having one
password.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"