GRCArizona
Board Regular
- Joined
- Apr 24, 2010
- Messages
- 95
Hi All -
I'm a little confused by what is happening when I use the 'Protect' method in my "Worksheet_Open" event. I have the following code and what I'm trying to accomplish is allow the end-user to Edit Scenarios and Drawing Objects. After running this code, I go and check the Protect properties on several worksheets (IE: select a worksheet, unprotect the worksheet and then re-protect it), I notice the 'Edit Objects' and 'Edit Scenarios' are NOT checked. I would think that by setting the variable to :=False, that I would see a check mark next to both of these properties. BTW, all the others are checked - except 'Select locked cells' (which is what I want). Any ideas on what I'm doing wrong?
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
wks.EnableOutlining = True
wks.EnableSelection = xlUnlockedCells
wks.Protect Password:="Hide_Your_Kids", DrawingObjects:=False, Contents:=True, Scenarios:= _
False, UserInterfaceonly:=True, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
Next wks
I'm a little confused by what is happening when I use the 'Protect' method in my "Worksheet_Open" event. I have the following code and what I'm trying to accomplish is allow the end-user to Edit Scenarios and Drawing Objects. After running this code, I go and check the Protect properties on several worksheets (IE: select a worksheet, unprotect the worksheet and then re-protect it), I notice the 'Edit Objects' and 'Edit Scenarios' are NOT checked. I would think that by setting the variable to :=False, that I would see a check mark next to both of these properties. BTW, all the others are checked - except 'Select locked cells' (which is what I want). Any ideas on what I'm doing wrong?
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
wks.EnableOutlining = True
wks.EnableSelection = xlUnlockedCells
wks.Protect Password:="Hide_Your_Kids", DrawingObjects:=False, Contents:=True, Scenarios:= _
False, UserInterfaceonly:=True, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
Next wks