Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Worksheet protection

The code below is what I want to use to protect my worksheets (if a certain
condition is met) Everything works well in that the Protect sub prevents the
selection of any cells. My problem is with the UnProtect routine. When it
runs it asks for a password (which I would prefer not to have) and it
displays each worksheet as it runs. When the Protect code runs it does not
display each worksheet yet each one is protected.


Dim Shts As Worksheet
Sub UnProtectAllSheets()

Shts.Unprotect
Next


End Sub

Sub ProtectAllSheets()

For Each Shts In ThisWorkbook.Worksheets
Shts.Protect EnableSelection = xlNoSelection
Next

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Worksheet protection

Sub UnProtectAllSheets()
Application.Screenupdating = False
for each Shts in Sheets
Shts.Unprotect password:="Put the password here"
Next
Application.Screenupdating = True
End Sub
Bob Umlas
Excel MVP

"ordnance1" wrote:

The code below is what I want to use to protect my worksheets (if a certain
condition is met) Everything works well in that the Protect sub prevents the
selection of any cells. My problem is with the UnProtect routine. When it
runs it asks for a password (which I would prefer not to have) and it
displays each worksheet as it runs. When the Protect code runs it does not
display each worksheet yet each one is protected.


Dim Shts As Worksheet
Sub UnProtectAllSheets()

Shts.Unprotect
Next


End Sub

Sub ProtectAllSheets()

For Each Shts In ThisWorkbook.Worksheets
Shts.Protect EnableSelection = xlNoSelection
Next

End Sub


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Worksheet protection

Thanks sir

I entered your code see below, and I protected each sheet with the password
snow but when the code runs I am prompted to enter the password for each
sheet.


Sub UnProtectAllSheets()

Application.ScreenUpdating = False

'Unprotects ALL worksheets
For Each Shts In ThisWorkbook.Worksheets
Shts.Unprotect Password:=snow
Next

Application.ScreenUpdating = True

End Sub

"Bob Umlas, Excel MVP" wrote in
message ...
Sub UnProtectAllSheets()
Application.Screenupdating = False
for each Shts in Sheets
Shts.Unprotect password:="Put the password here"
Next
Application.Screenupdating = True
End Sub
Bob Umlas
Excel MVP

"ordnance1" wrote:

The code below is what I want to use to protect my worksheets (if a
certain
condition is met) Everything works well in that the Protect sub prevents
the
selection of any cells. My problem is with the UnProtect routine. When it
runs it asks for a password (which I would prefer not to have) and it
displays each worksheet as it runs. When the Protect code runs it does
not
display each worksheet yet each one is protected.


Dim Shts As Worksheet
Sub UnProtectAllSheets()

Shts.Unprotect
Next


End Sub

Sub ProtectAllSheets()

For Each Shts In ThisWorkbook.Worksheets
Shts.Protect EnableSelection = xlNoSelection
Next

End Sub


.

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
Worksheet Protection nhen5 Excel Discussion (Misc queries) 1 May 5th 07 03:04 AM
Worksheet protection frederick Excel Discussion (Misc queries) 3 December 14th 06 01:39 AM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Worksheet Protection stwky Excel Discussion (Misc queries) 3 April 12th 05 10:21 AM


All times are GMT +1. The time now is 12:41 AM.

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"