password problem with protect worksheet

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?
 
A

Adriaan vd Linde

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top