Not Select locked cells

Joined
Jul 25, 2007
Messages
26
Reaction score
0
To All, The following is a portion of the code I use to protect my sheets. When I close and save the workbook then open the file the sheets are still protected but the user can select the locked cells (but not change) as well as the unlocked cells. If I protect the sheets individually by tools\protection\protect sheet\select unlocked cells (select unlocked cells is the only item checked) the sheets stay as saved when closed and reopened. As I have 25 sheets doing this is a pain. Will someone tell me a way to fix this. I have tried another code to protect all but the results were the same when I reopened the workbook.
Thanks All GeoffreyBarnard
Private Sub CommandButton3_Click()
'Allows the user to only select the unlocked cells
'Locked cells are unable to be selected
Application.ScreenUpdating = False
Sheets("Match One").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells

Sheets("Match Two").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
'Etc 'Match Three' 'Match Four' Etc
End Sub
 
Last edited:
Back
Top