Register now or log in to join your professional community.
the stright to point method is:
worksheet.unprotect "password"
press alt F11 a popup window will appear, insert a security module in the VBA code using insert menu,then copy paste the window and save it and execute it by pressing F5
press alt f11 insert a module using insert menu,then copy paste the window.and execute it by pressing f5
A string that denotes the case-sensitive password to use to unprotect the sheet or workbook. If the sheet or workbook isn't protected with a password, this argument is ignored. If you omit this argument for a sheet that's protected with a password, you'll be prompted for the password. If you omit this argument for a workbook that's protected with a password, the method fails.
Private Sub Unprotectsheet()
'This code will protect "Sheet1" with the password test
ActiveSheet.Unprotect Password:="test"
Sheets("Sheet1").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
ActiveSheet.Protect Password:="test"
'This below code will then unprotect "sheet1" using password "test", you only 'need this bit for your question
Sheets("Sheet1").Select
ActiveSheet.Unprotect Password:="test"
'or you can use
Sheets("sheet1").Unprotect Password:="test"
End Sub