S
swatsp0p
ok, programmers... I'm stumped. Writing code to protect a group of
sheets, I cannot figure how to prevent users from "Selecting Locked
Cells", which is a choice in the Protect Sheet menu.
According to VBA, the choices for ActiveSheet.PROTECT are:
-expression.Protect(Password, DrawingObjects, Contents, Scenarios,
UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns,
AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows,
AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows,
AllowSorting, AllowFiltering, AllowUsingPivotTables)-
Current code looks like this:
Code:
--------------------
Sub PROTECT()
'
Sheets("January").Select
ActiveSheet.PROTECT DrawingObjects:=True, Contents:=True, Scenarios:=True,_
AllowFiltering:=True, UserInterfaceOnly:=True
Sheets("February").Select
......
End Sub
--------------------
I am trying to keep the user in ONLY the 'Unlocked' cells within each
sheet. After running the above code, the user is free to move to any
cell within the sheet, locked or not. Of course the contents are
protected from changes, but can still be selected.
Also, when I manually set this option (unchecking "Selecting Locked
Cells"), save and close the file, when re-opened the protection is in
place, yet all cells can once again be selected.
Ideas, anyone?
Thanks...
Bruce
sheets, I cannot figure how to prevent users from "Selecting Locked
Cells", which is a choice in the Protect Sheet menu.
According to VBA, the choices for ActiveSheet.PROTECT are:
-expression.Protect(Password, DrawingObjects, Contents, Scenarios,
UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns,
AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows,
AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows,
AllowSorting, AllowFiltering, AllowUsingPivotTables)-
Current code looks like this:
Code:
--------------------
Sub PROTECT()
'
Sheets("January").Select
ActiveSheet.PROTECT DrawingObjects:=True, Contents:=True, Scenarios:=True,_
AllowFiltering:=True, UserInterfaceOnly:=True
Sheets("February").Select
......
End Sub
--------------------
I am trying to keep the user in ONLY the 'Unlocked' cells within each
sheet. After running the above code, the user is free to move to any
cell within the sheet, locked or not. Of course the contents are
protected from changes, but can still be selected.
Also, when I manually set this option (unchecking "Selecting Locked
Cells"), save and close the file, when re-opened the protection is in
place, yet all cells can once again be selected.
Ideas, anyone?
Thanks...
Bruce