password problem with protect worksheet

  • Thread starter Thread starter Soe
  • Start date Start date
S

Soe

i tried to protect worksheet with password, then unprotect again, but it
doesn't work, it shows password error.
i simply used like

activeworksheet.protect password := "abc"

then
activesheet.unprotect password:="abc"

anybody can advice where i m wrong?
 
This is a copy of coding that is running in an apps of
mine.

Remember to protect each sheet by running a VBA prog

Sub MyProtect()
ActiveWorkbook.Protect Password:="ZAC"
ActiveSheet.Protect Password:="ZAC"
End Sub

Sub MyUnprotect()
ActiveWorkbook.Unprotect Password:="ZAC"
ActiveSheet.Unprotect Password:="ZAC"
End Sub
 
Back
Top