I know how to tell a macro to protect and unprotect a sheet.
is there a way that i can tell it to protect and unprotect and specify a password?
activesheet.protect or will protect it but no password.
thanks in advance
I know how to tell a macro to protect and unprotect a sheet.
is there a way that i can tell it to protect and unprotect and specify a password?
activesheet.protect or will protect it but no password.
thanks in advance
Good afternoon tkaplan
Try this code
ActiveSheet.Protect Password:="my_pass"
ActiveSheet.Unprotect Password:="my_pass"
HTH
DominicB
Thank you.
this worked to put a password over the protection but then if i want to manually go and unprotect it it tells me i have the wrong password.
if i write a macro to go and unprotect everything that works but i want to just unprotect what i need manually by going to tool/protection and putting in the password.
caps was not on but i tried doing capitals also and that didnt work either.
Hi tkaplan
Ok, two things.
First I used and tested the macros below to destruction using them to protect sheets and unprotect manually, manually protect and unprotect using the macro, and using them interchanged and cannot recreate the problem you are reporting. I am using WinXP and Excel 2003.
Sub protect()
ActiveSheet.protect Password:="my_pass"
End Sub
Sub unprotect()
ActiveSheet.unprotect Password:="my_pass"
End Sub
Secondly, I'm not sure what you mean by unprotect everything - do you mean every sheet, or every cell. If you mean every cell you need to change the protection status - alt +1, protection,check / uncheck the locked box. You can do it from VBA thus:
Range("A1").Locked = False
Range("A1").Locked = True
HTH
DominicB
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks