Password Protect Active Sheets Issue

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57
Hi Folks!

I am hoping someone can help me out. I have a workbook with 84 tabs which all tabs need to be password protected. I came up with the code below but then I realized that several of the tabs require various other formatting requirements other than AllowFormmattingRows:=True.

For example, I have some tabs that need AllowFormattingColumns:=True, AllowFormattingCells:=True, AllowEditObjects:=True and different combinations thereof. Is it possible to assign different formats to individual tabs versus assigning the same formats to all tabs in the workbook?

I've been messing around with it tonight and can't get it there. I appreciate the help!

Code:
Sub protect_all_sheets()
On Error GoTo fixpw
pass = InputBox("password")
For Each Worksheet In ActiveWorkbook.Worksheets
Worksheet.Protect Password:=pass, AllowFormattingRows:=True
Next
Exit Sub
fixpw: MsgBox "There is a problem - check your password, capslock, etc."
End Sub
 
Hi Fluff,

I got this figured out after I researched DrawingObjects. I really appreciate your help. This is going to save me so much time.

Thanks!
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Glad you figured it out & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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