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.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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
 
Upvote 0
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?)
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

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
Back
Top