protect sheet in VB
Mark, try this
ActiveSheet.Protect password:="123", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
or with a input box to select a password
pw = InputBox("What password do you want to use ?")
ActiveSheet.Protect password:=pw, DrawingObjects:=True, _
Contents:=True, Scenarios:=True
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"Mark Howard" wrote in message
...
Hi,
I want to use the below line lock a sheet
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
and assign a password.
then the macro will hide the sheet.
ActiveWindow.SelectedSheets.Visible = False
Another Macro will unhide the sheet and then unlock it
with a password prompt.
ActiveWindow.SelectedSheets.Visible = False
ActiveSheet.Unprotect
but this does not work. I cannot assign a password on
protecting.
any ideas?
|