• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

unlocking protect sheet password

webmax

Member
hi,

i have a excel template which containts the protect sheet password which was set by me. i send this excel file to multiple persons and they update the required data and send to us. for consolidating the excel file i need the macro to remove the protect sheet password. for example if i keep the password as "abc".
 
Code:
Sub Unprotect_Sheet()
  ActiveSheet.Unprotect "abc"
  ' or
  Worksheets("Sheet1").Unprotect "abc" 'Change Worksheet name to suit
End Sub
 
@webmax

Please Try this

Code:
Sub UnprotectSheets()
Dim wSheet As Worksheet
 
    For Each wSheet In Worksheets
 
        If wSheet.ProtectContents = True Then
 
            wSheet.Unprotect Password:="abc"
 
        Else
 
            wSheet.Protect Password:="abc"
 
        End If
 
    Next wSheet
 
 
End Sub

Hope it solve your problem

Thanks

SP
 
Back
Top