Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings and TIA for your time
I am using the code below to protect selected worksheets so that the user can only select unlocked cells and can enter comments (in unlocked cells) Running the code below has the desired effect. However, when I save the file, close and re-open, the protection is still in place but the user can now also select locked cells. How do I prevent the user selecting locked cells after save, close and re-open? Sub ProtectSelectedSheets() Dim wks As Worksheet Dim myarray() ReDim myarray(1 To ActiveWindow.SelectedSheets.Count) counter = 0 For Each wks In ActiveWindow.SelectedSheets counter = counter + 1 myarray(counter) = wks.Name Next For i = 1 To counter With Worksheets(myarray(i)) .EnableSelection = xlUnlockedCells .Protect Password:="pwd", DrawingObjects:=False, _ Contents:=True, Scenarios:=True, userinterfaceonly:=True End With Next End Sub -- David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protect sheets in one go | Excel Discussion (Misc queries) | |||
Protect some sheets in an xls but not all. | Excel Worksheet Functions | |||
Protect all Sheets | Excel Discussion (Misc queries) | |||
how to protect sheets from VBA? | Excel Programming | |||
Protect a few sheets | Excel Programming |