Prevent selecting locked cells
Andy, this is a setting that xl doesn't remember between closings,so have
your auto_open or workbook_open code do it each time, like this
Private Sub Workbook_Open()
'will not let you select locked cells
'change to your worksheet name
With Worksheets("sheet1")
..Activate
..EnableSelection = xlUnlockedCells
'change to your passwrd
'commet out if you don't want a password
..Protect "123"
..Protect Contents:=True, UserInterfaceOnly:=True
End With
End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
"Andy" wrote in message
...
I would like to be able to prevent users from selecting locked cells in a
worksheet and to do this have used the EnableSelection property with the
Protect method. The problem I had was that when the workbook is closed
and
re-opened the locked cells are still selectable. Having looked at
previous
posts I see that this is because the EnableSelection property is not
persistent. However, it does seem to be persistent if I manually protect
the
worksheet so that only unlocked cells can be selected. How come this can't
be
achieved with VBA?
|