Home |
Search |
Today's Posts |
#1
|
|||
|
|||
macro for Protecting a Sheet
Hello everyone...
Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
#2
|
|||
|
|||
Try
ActiveSheet.Protect ("Your_Password") Regards, Alan. "cincode5" wrote in message ... Hello everyone... Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
#3
|
|||
|
|||
Hi Alan & thanks...
This works great, although it wasn't exactly what I was looking to accomplish since this approach predefines the password (assuming I'm applying your suggestion correctly). Consequently however, it does solves another issue with this spreadsheet - namely admin security and control. These users arent sophistated enough to know how to compromise an xls password, but I've incorporated adminstrator control regardless to address multi users (families members) who have editing privlidges via 'Allow Users to Edit Ranges'. I'm giving this spreadsheet to acquentences so its not a Corp thing, but this approach will require I give those less knowledgable with VB instructions on how to modify the password within the macro. Not a problem though. Thanks again for the tip. Much appreciated. -- Regards... "Alan" wrote: Try ActiveSheet.Protect ("Your_Password") Regards, Alan. "cincode5" wrote in message ... Hello everyone... Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
#4
|
|||
|
|||
cincode5, if you want the user to pick a password you could use something
like this Sub protect() Dim pw As String pw = InputBox("Enter your password to protect the sheet ?") ActiveSheet.protect Password:=pw, DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub -- 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 2002 & 2003 "cincode5" wrote in message ... Hi Alan & thanks... This works great, although it wasn't exactly what I was looking to accomplish since this approach predefines the password (assuming I'm applying your suggestion correctly). Consequently however, it does solves another issue with this spreadsheet - namely admin security and control. These users arent sophistated enough to know how to compromise an xls password, but I've incorporated adminstrator control regardless to address multi users (families members) who have editing privlidges via 'Allow Users to Edit Ranges'. I'm giving this spreadsheet to acquentences so its not a Corp thing, but this approach will require I give those less knowledgable with VB instructions on how to modify the password within the macro. Not a problem though. Thanks again for the tip. Much appreciated. -- Regards... "Alan" wrote: Try ActiveSheet.Protect ("Your_Password") Regards, Alan. "cincode5" wrote in message ... Hello everyone... Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
#5
|
|||
|
|||
Paul...
Even better... Thanks for the tip. I needed to have the individulal admin set the password without accessing VB code. This is what I was looking for. Thanks again Paul! -- Regards... -- Regards... "Paul B" wrote: cincode5, if you want the user to pick a password you could use something like this Sub protect() Dim pw As String pw = InputBox("Enter your password to protect the sheet ?") ActiveSheet.protect Password:=pw, DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub -- 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 2002 & 2003 "cincode5" wrote in message ... Hi Alan & thanks... This works great, although it wasn't exactly what I was looking to accomplish since this approach predefines the password (assuming I'm applying your suggestion correctly). Consequently however, it does solves another issue with this spreadsheet - namely admin security and control. These users arent sophistated enough to know how to compromise an xls password, but I've incorporated adminstrator control regardless to address multi users (families members) who have editing privlidges via 'Allow Users to Edit Ranges'. I'm giving this spreadsheet to acquentences so its not a Corp thing, but this approach will require I give those less knowledgable with VB instructions on how to modify the password within the macro. Not a problem though. Thanks again for the tip. Much appreciated. -- Regards... "Alan" wrote: Try ActiveSheet.Protect ("Your_Password") Regards, Alan. "cincode5" wrote in message ... Hello everyone... Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
#6
|
|||
|
|||
Your Welcome
-- 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 2002 & 2003 "cincode5" wrote in message ... Paul... Even better... Thanks for the tip. I needed to have the individulal admin set the password without accessing VB code. This is what I was looking for. Thanks again Paul! -- Regards... -- Regards... "Paul B" wrote: cincode5, if you want the user to pick a password you could use something like this Sub protect() Dim pw As String pw = InputBox("Enter your password to protect the sheet ?") ActiveSheet.protect Password:=pw, DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub -- 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 2002 & 2003 "cincode5" wrote in message ... Hi Alan & thanks... This works great, although it wasn't exactly what I was looking to accomplish since this approach predefines the password (assuming I'm applying your suggestion correctly). Consequently however, it does solves another issue with this spreadsheet - namely admin security and control. These users arent sophistated enough to know how to compromise an xls password, but I've incorporated adminstrator control regardless to address multi users (families members) who have editing privlidges via 'Allow Users to Edit Ranges'. I'm giving this spreadsheet to acquentences so its not a Corp thing, but this approach will require I give those less knowledgable with VB instructions on how to modify the password within the macro. Not a problem though. Thanks again for the tip. Much appreciated. -- Regards... "Alan" wrote: Try ActiveSheet.Protect ("Your_Password") Regards, Alan. "cincode5" wrote in message ... Hello everyone... Just wondering what the line of code would look like that protects a sheet via the press of a (macro) button. For reason undisclosed, I dont want users to go the Tools / Protection routine, but I can only get the macro to work without password protection. Here is what I am using: ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True but again this only works without a password. Any ideas? -- Regards... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Range Mess | Charts and Charting in Excel | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions | |||
MACRO - copy rows based on value in column to another sheet | Excel Discussion (Misc queries) | |||
2 questions, copying data from sheet to sheet and assigning macro | Excel Worksheet Functions | |||
Macro for multiple charts | Excel Worksheet Functions |