Workbook Protect / unprotect

Excel-ent

Active Member
Joined
Mar 4, 2004
Messages
338
Dear Experts,

I have 75 sheets in a workbook. All these sheets are protected with the Same Password. Is there any code to un-protect all the worksheets at the same time and another code to protect all these sheets at the same time.

I am using Windows 98 and Office 2000.

Thanks for all your efforts..

Regards,

Shan

P.S. I am sorry if this topic is discussed earlier, could not find it during my search.
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
Just Shan said:
Dear Experts,

I have 75 sheets in a workbook. All these sheets are protected with the Same Password. Is there any code to un-protect all the worksheets at the same time and another code to protect all these sheets at the same time.

I am using Windows 98 and Office 2000.

Thanks for all your efforts..

Regards,

Shan

P.S. I am sorry if this topic is discussed earlier, could not find it during my search.

Try ASAP Utilities

www.asap-utilities.com
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Heya Shan,

Give this a shot:
Code:
Sub ProtectMe()
    Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
            ws.Protect Password:="password"
        Next ws
End Sub

Sub UnProtectMe()
    Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
            ws.Unprotect Password:="password"
        Next ws
End Sub
Hope that helps,

Smitty

(Hey Brian! :p How ya' doin?)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,221
Messages
5,594,898
Members
413,950
Latest member
solve22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top