Anthony asks "When selecting the '0 -xlUnlockedCells' properity in the EnableSelection
window only the unlocked cells can be selected when the workbook is
protected. However, when the workbook is Saved, Closed and then re-opened
the EnableSelection defaults back to '0 -xlNoRestrictions' how can I stop
Well, this can be solved using some events. One, using the Workbook_Open event, or two, using the Sheet_Activate event, like this:
In the workbook Module
Private Sub Workbook_Open()
Sheets("Sheet1").EnableSelection = xlUnlockedCells
or in the Sheet's Module
Private Sub Worksheet_Activate()
ActiveSheet.EnableSelection = xlUnlockedCells
One final thing, xlUnlockedCells equals 1, not 0. 0 is xlNoRestrictions and -4142 is xlNoSelection.
By Juan Pablo Gonzalez on 12-Feb-2002
MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data.
MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.
Excel is a registered trademark
of the Microsoft® Corporation.
All contents Copyright
1998-2008 by MrExcel Consulting.