Unprotecting Selected Sheets Only on Multiple Fil

stroffso

Board Regular
Joined
Jul 12, 2016
Messages
160
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have 20 files to edit, all of which have a differing number of tabs protected (with the same password), What I want to do is select the protected tabs on each file manually, then run some code to unprotect, I then do what I need to do and protect again using similar code. Also to note that the tab names to protect and unprotect on each file are different

I have the below and have searched around but can only find protect or unprotect all routines. Would anyone be able to help here?


VBA Code:
Sub UnProtectAllSheets()
    Dim ws As Worksheet

    For Each ws In Worksheets
        ws.Unprotect "john12345"
    Next ws

End Sub
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Maybe use a button or something to call the below module? You would need to select your sheets and run the following...

VBA Code:
Sub UnprotectSelected()
    Dim ws As Worksheet
    For Each ws In ActiveWindow.SelectedSheets
         ws.Unprotect "john12345"
    Next ws
End Sub
 
Upvote 0
Maybe use a button or something to call the below module? You would need to select your sheets and run the following...

VBA Code:
Sub UnprotectSelected()
    Dim ws As Worksheet
    For Each ws In ActiveWindow.SelectedSheets
         ws.Unprotect "john12345"
    Next ws
End Sub
Outstanding thank you that works great
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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