I'm trying to unprotect an Excel worksheet from within a macro (when the sheet has previously been protected with a password), but I keep getting the following error message:
"Unprotect method of worksheet class failed"
The macro executes from a button placed within the sheet I'm trying to unprotect. I've tried unprotecting the sheet directly with
and also by activating the sheet and then using
, but neither works. I've also tried protecting the sheet with no password and then using Unprotect, but the same error happens. What could be causing this? Protecting the sheet from within the macro works fine, as does protecting/unprotecting workbooks.
Thanks
"Unprotect method of worksheet class failed"
The macro executes from a button placed within the sheet I'm trying to unprotect. I've tried unprotecting the sheet directly with
Code:
Sheets("SheetName").Unprotect Password:="Password"
and also by activating the sheet and then using
Code:
ActiveSheet.Unprotect
Thanks