View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Password and Macro

Without seeing the code it's hard to say what's going wrong but a sheet
password protected with code should ask for a password to un-protect it.

Try this:-

Sub protect()
ActiveSheet.protect Password:="mypass"
End Sub

Mike

"Wanna Learn" wrote:

Hello I have a workbook with several spreadsheets. I created a macro to
format a workshheet, e.g. copy and paste special values and protect the
worksheet with a password then go to another worksheet and protect the
worksheet with a password and return to the original worksheet. WHen I run
the macro everything is fine except that when I unprotect the worksheet it
does not ask me for a password but it unprotects the worksheets anyway I
don't want anyone to be able to unprotect these worksheets without the
password. Help and Thanks