Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protection in macro ( Anybody can view my password in VB Sherees Excel Discussion (Misc queries) 2 January 24th 10 10:05 PM
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
Password protection of Excel Sheet linked to Bloomberg Data Rohit Excel Discussion (Misc queries) 0 June 28th 05 10:29 AM
Detect Password Protection on a Sheet Chris Gorha Excel Programming 2 January 10th 04 09:17 AM


All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"