Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sheet Protection & Password
Hello Everybody,
Is it possible to add some code to each worksheet that will enable me to protect the worksheet and have a permanent password. At the moment, when you unprotect the worksheet, you have to re-enter the password (twice) to protect it again. I would like to be able to have the password in place all the time so the user does not have to re-enter it again and again. Thanks heaps |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sheet Protection & Password
Something like:
Sub Unprotect() ThisWorkbook.Worksheets("Report").Unprotect Password:="Password HERE" ActiveSheet.Unprotect End Sub Sub Protect() ThisWorkbook.Worksheets("Report").Protect Password:="Password HERE" ActiveSheet.Protect End Sub You could add the codes to the WorkSheet_Change vent or similar to suit. Corey... "will07" wrote in message ... Hello Everybody, Is it possible to add some code to each worksheet that will enable me to protect the worksheet and have a permanent password. At the moment, when you unprotect the worksheet, you have to re-enter the password (twice) to protect it again. I would like to be able to have the password in place all the time so the user does not have to re-enter it again and again. Thanks heaps |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sheet Protection & Password
I would use this code. This will protect or unprotect all your sheets. You
can call this code several ways. 1.) Setup a custom buttons in a toolbar and assign a macro to each one. This way you just click a button in the toolbar and "Waaala" the worksheets are protected. 2.) You can put the code in a Worksheet Event such as: Worksheet_Activate and Worksheet_Deactivate. This will unprotect the worksheet when it is selected and protect it when another sheet is selected. 3.) Put command buttons on the worksheet somewhere and assign these macros to them. I use #1. Sub Protect() Dim wks As Worksheet For Each wks In Worksheets wks.Protect Password:="password" Next wks End Sub Sub UnProtect() Dim wks As Worksheet For Each wks In Worksheets wks.UnProtect Password:="password" Next wks End Sub -- Cheers, Ryan "will07" wrote: Hello Everybody, Is it possible to add some code to each worksheet that will enable me to protect the worksheet and have a permanent password. At the moment, when you unprotect the worksheet, you have to re-enter the password (twice) to protect it again. I would like to be able to have the password in place all the time so the user does not have to re-enter it again and again. Thanks heaps |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Password protection in macro ( Anybody can view my password in VB | Excel Discussion (Misc queries) | |||
Excel Data Protection Best Practice: AKA: Real Sheet Protection | Excel Discussion (Misc queries) | |||
Excel Data Protection- AKA: Sheet/Macro Password Protection | Setting up and Configuration of Excel | |||
Password protection of Excel Sheet linked to Bloomberg Data | Excel Discussion (Misc queries) | |||
Detect Password Protection on a Sheet | Excel Programming |