Forum Discussion
esatyilmaz
Jul 14, 2022Copper Contributor
Excel 365 VBA vs Review>Protect Sheet password
Hello, I am encountering a strange issue. I lock a worksheet by Review>Protect Sheet and set a worksheet password such as 0010 and then in the VBA code I want to unprotect with the same password ...
- Jul 14, 2022
At the beginning of the procedure you can use
Me.Unprotect("0010")
or you can use
ActiveWorkbook.ActiveSheet.Unprotect("0010")
to use'Your code
at the end of the procedure
Me.Protect ("0010")
or you can
ActiveWorkbook.ActiveSheet.Protect("0010")
to use.Hope I could help you with these information
I know I don't know anything (Socrates)
HansVogelaar
Jul 14, 2022MVP
It should be
Worksheets("Example").Unprotect Password:="0010"
with := between Password and its value.
- esatyilmazJul 14, 2022Copper ContributorThanks for your help Hans.