Error unprotecting worksheet

  • Thread starter Thread starter Dan Winterton
  • Start date Start date
D

Dan Winterton

I am getting an error message when I try to use VBA code
to unprotect a worksheet. The code is simple:

Sheets("sheetname").Select
ActiveSheet.Unprotect

There is no password assigned. But I get an
error: "Unprotect method of worksheet class failed."

What am I doing wrong? Any ideas? I have no problem
protecting a worksheet with VBA code (ActiveSheet.Protect
DrawingObjects:="True"... etc...)

Any help is greatly appreciated.
Dan
 
All I can suggest that the workbook has become corrupted in some way. Does
it do the same in another workbook? If not you may have to copy all the data
and codes into a new workbook, a pain I know (speaking from experience)
Regards,
Alan.
 
What version of excel are you using?

How are you invoking the code?

Do you have any "on error resume next" lines that could be masking any errors
(I'm guessing a typo in the worksheet name stops the .select from working
correctly). And the activesheet isn't what you think it is.
 
Back
Top