Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Unprotecting Worksheets

Hello.

I have a file that has multiple worksheets, each are protected (locked) with
a similar password for each worksheet. Is there a way to unprotect all
worksheets all at once without having to click on each sheet and unprotect it
that way? Is there a Macro? Or something?

Thank you!
Storm

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Unprotecting Worksheets

That fact that the passwords are different makes things a bit trickier...
Give this a try... You will need to copy the one line indicated to accomodate
all of the passwords that exist in the spreadsheet...

Sub UnprotectAll()
Call UnprotectSheets("Password1") 'Copy this
Call UnprotectSheets("Password2")
Call UnprotectSheets("Password3")
End Sub

Sub UnprotectSheets(ByVal strPassword As String)
Dim wks As Worksheet

On Error Resume Next
For Each wks In Worksheets
wks.Unprotect Password:=strPassword
Next wks
On Error GoTo 0

End Sub
--
HTH...

Jim Thomlinson


"Storm" wrote:

Hello.

I have a file that has multiple worksheets, each are protected (locked) with
a similar password for each worksheet. Is there a way to unprotect all
worksheets all at once without having to click on each sheet and unprotect it
that way? Is there a Macro? Or something?

Thank you!
Storm

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default Unprotecting Worksheets

Hello Jim,

Thank you for your response. Actually, we have only 1 password for each
worksheet. By the way, I'm not so familiar with creating macros thru VB
script but I will try. All I need to do is copy paste your script below but
since I have only 1 password for each worksheet, I just need one line. By
the way, how is this macro executed? I'm so sorry if this sounds like a
stupid question. Does it execute upon opening the spreadsheet?

Thank you again Jim,
Storm

"Jim Thomlinson" wrote:

That fact that the passwords are different makes things a bit trickier...
Give this a try... You will need to copy the one line indicated to accomodate
all of the passwords that exist in the spreadsheet...

Sub UnprotectAll()
Call UnprotectSheets("Password1") 'Copy this
Call UnprotectSheets("Password2")
Call UnprotectSheets("Password3")
End Sub

Sub UnprotectSheets(ByVal strPassword As String)
Dim wks As Worksheet

On Error Resume Next
For Each wks In Worksheets
wks.Unprotect Password:=strPassword
Next wks
On Error GoTo 0

End Sub
--
HTH...

Jim Thomlinson


"Storm" wrote:

Hello.

I have a file that has multiple worksheets, each are protected (locked) with
a similar password for each worksheet. Is there a way to unprotect all
worksheets all at once without having to click on each sheet and unprotect it
that way? Is there a Macro? Or something?

Thank you!
Storm

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Unprotecting Worksheets

I am lost. One workbook contains many worksheets. Each worksheet can have a
different password associated with it. Do each of your sheets have different
passwords, or do you use the same password on each sheet? In any case if you
only have one password then you can just use the one line. If you have
multiple passwords then you can use multiple lines...

To call the procudure do the following (I am assuming that you would like to
have a button).

Open the VBE (Alt+F11) - Select Insert|Module - A code module will be
added to your project. Paste in the code that I provided. Go back to XL. On a
sheet copy a command button from the Forms Toolbar to your sheet. You will be
prompted to assign a macro. Select UnprotectAll.
--
HTH...

Jim Thomlinson


"Storm" wrote:

Hello Jim,

Thank you for your response. Actually, we have only 1 password for each
worksheet. By the way, I'm not so familiar with creating macros thru VB
script but I will try. All I need to do is copy paste your script below but
since I have only 1 password for each worksheet, I just need one line. By
the way, how is this macro executed? I'm so sorry if this sounds like a
stupid question. Does it execute upon opening the spreadsheet?

Thank you again Jim,
Storm

"Jim Thomlinson" wrote:

That fact that the passwords are different makes things a bit trickier...
Give this a try... You will need to copy the one line indicated to accomodate
all of the passwords that exist in the spreadsheet...

Sub UnprotectAll()
Call UnprotectSheets("Password1") 'Copy this
Call UnprotectSheets("Password2")
Call UnprotectSheets("Password3")
End Sub

Sub UnprotectSheets(ByVal strPassword As String)
Dim wks As Worksheet

On Error Resume Next
For Each wks In Worksheets
wks.Unprotect Password:=strPassword
Next wks
On Error GoTo 0

End Sub
--
HTH...

Jim Thomlinson


"Storm" wrote:

Hello.

I have a file that has multiple worksheets, each are protected (locked) with
a similar password for each worksheet. Is there a way to unprotect all
worksheets all at once without having to click on each sheet and unprotect it
that way? Is there a Macro? Or something?

Thank you!
Storm

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unprotecting a Worksheet Anney Excel Worksheet Functions 7 August 4th 07 01:14 PM
Unprotecting the unprotected Wally S Excel Discussion (Misc queries) 2 December 31st 06 01:24 AM
Unprotecting a Sheet SergioCorreiaMaputo Excel Discussion (Misc queries) 3 June 20th 06 10:56 AM
Unprotecting worksheets hip Excel Worksheet Functions 4 June 5th 06 07:37 AM
unprotecting a worksheet Randy123 Excel Discussion (Misc queries) 1 August 8th 05 06:11 PM


All times are GMT +1. The time now is 04:33 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"