Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Katherine R
 
Posts: n/a
Default Protect/Unprotect Multiple Worksheets

I used the following macro from an earlier posting to protect multiple
worksheets in a workbook and it worked great. (Thank you Kevin Backmann!!!)

Now I would like a macro to do the reverse - that is unprotect all
worksheets. I tried the same macro changing every instance of the word
Protect to Unprotect, but that didn't work. What can I do to make this work?

Thanks. (I've copied and pasted Kevin's earlier posting below:)

-------------------------------------------

"The following macro cycless through all the worksheets in the active
workbook, protecting them and assigning the password of "Password"

Sub ProtectAll()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
ws.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, _
Password:="Password"
Next ws

Set wb = Nothing
Set ws = Nothing

End Sub

Place it in a VBA module by pressing Alt+F11, click INSERT on the menu and
select MODULE. You can either type the code above or cut and paste it. To
run the macro select TOOLS on the menu, click MACRO and then select MACROS.
The macro will be in the list of available macros. You can select it and
then click the RUN command button."

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Protect/Unprotect Multiple Worksheets

'--------------------------
Sub unprotectall()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
ws.Unprotect _
Password:="Password"
Next ws

Set wb = Nothing
Set ws = Nothing

End Sub
'-------------------------------

HTH
--
AP

"Katherine R" a écrit dans le message
de news: ...
I used the following macro from an earlier posting to protect multiple
worksheets in a workbook and it worked great. (Thank you Kevin
Backmann!!!)

Now I would like a macro to do the reverse - that is unprotect all
worksheets. I tried the same macro changing every instance of the word
Protect to Unprotect, but that didn't work. What can I do to make this
work?

Thanks. (I've copied and pasted Kevin's earlier posting below:)

-------------------------------------------

"The following macro cycless through all the worksheets in the active
workbook, protecting them and assigning the password of "Password"

Sub ProtectAll()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
ws.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, _
Password:="Password"
Next ws

Set wb = Nothing
Set ws = Nothing

End Sub

Place it in a VBA module by pressing Alt+F11, click INSERT on the menu and
select MODULE. You can either type the code above or cut and paste it.
To
run the macro select TOOLS on the menu, click MACRO and then select
MACROS.
The macro will be in the list of available macros. You can select it and
then click the RUN command button."



  #3   Report Post  
Posted to microsoft.public.excel.misc
Katherine R
 
Posts: n/a
Default Protect/Unprotect Multiple Worksheets

Thank you!

"Ardus Petus" wrote:

'--------------------------
Sub unprotectall()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
ws.Unprotect _
Password:="Password"
Next ws

Set wb = Nothing
Set ws = Nothing

End Sub
'-------------------------------

HTH
--
AP

"Katherine R" a écrit dans le message
de news: ...
I used the following macro from an earlier posting to protect multiple
worksheets in a workbook and it worked great. (Thank you Kevin
Backmann!!!)

Now I would like a macro to do the reverse - that is unprotect all
worksheets. I tried the same macro changing every instance of the word
Protect to Unprotect, but that didn't work. What can I do to make this
work?

Thanks. (I've copied and pasted Kevin's earlier posting below:)

-------------------------------------------

"The following macro cycless through all the worksheets in the active
workbook, protecting them and assigning the password of "Password"

Sub ProtectAll()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
ws.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, _
Password:="Password"
Next ws

Set wb = Nothing
Set ws = Nothing

End Sub

Place it in a VBA module by pressing Alt+F11, click INSERT on the menu and
select MODULE. You can either type the code above or cut and paste it.
To
run the macro select TOOLS on the menu, click MACRO and then select
MACROS.
The macro will be in the list of available macros. You can select it and
then click the RUN command button."




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
SUMif or SUMproduct across multiple worksheets? Eric Shamlin Excel Worksheet Functions 1 September 29th 05 09:55 AM
Line chart from multiple worksheets Paul B. Charts and Charting in Excel 2 September 21st 05 11:46 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Update multiple worksheets Lizz45ie Excel Discussion (Misc queries) 0 May 31st 05 09:21 PM
Countif with multiple criteria and multiple worksheets JJ Excel Worksheet Functions 1 December 28th 04 06:37 PM


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