View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default How do I unprotect a sheet within a macro?

Worksheets("Template").Unprotect Password:="MyPassword"
Worksheets("Template").Protect Password:="MyPassword"

Mike F

"Mick" wrote in message
...
Please can anyone advise how I can overcome this Run-time error when using
the code
below:

"Unprotect method of worksheet class failed"

Worksheets("Template").Protect Password:="MyPassword"


Or what code should I use to remove a password format a sheet using

another
macro and put the same password back on again.
--
Kind Regards

Mick