Reputation: 1
I have macro enabled workbook. Both Workbook and sheets are password protected.
Basically, I have 2 sheets. First "crater" which has a drop down list and buttons.
Second, "Uno
" which has buttons again( Its a hidden sheet)
Button 1 on crater page task is to just copy the "Uno
" sheet and create a new sheet. All tasks are working fine.
But my problem is, when I create a child sheet and save and close the workbook.
Next time, As soon as I open workbook I get an "error '1004'. You cannot use the command on protected sheet. You must first unprotect sheet" .
I would like to know, Where can I use the code to unprotect sheet in this case?
I am confused, please help
Upvotes: 0
Views: 2011
Reputation: 33672
Use the command Worksheet("Your_Sheet_Name").Unprotect
if you have a password you need to add it as well Worksheet("Your_Sheet_Name").Unprotect(Password)
You can have it in the Workbook Open and it will unlock the worksheet. However, then all the users can modify this worksheet as well.
Upvotes: 1