R
ryguy7272
Hi, I am trying to auto-protect a sheet upon workbook close (so people a
certain person doesn’t forget to reapply protection when closing out of a
file that he maintains).
The below macro works fine, but disables ALL options for the user.
Sub ApplySecurity()
Worksheets("Master").Protect Password:="1225"
End Sub
I’d like to allow the user to a few basic things, such as select
locked/unlocked cells, use auto filter, and edit objects.
Sub ApplySecurity()
Worksheets("Master").Protect DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFiltering:=True Worksheets("Master").Protect
End Sub
How do I add the password in there? I’ve tried a couple things; I get only
errors.
In ThisWorkbook, I’ve got:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub
Private Sub Workbook_Open()
Call ApplySecurity
End Sub
Thanks,
Ryan--
certain person doesn’t forget to reapply protection when closing out of a
file that he maintains).
The below macro works fine, but disables ALL options for the user.
Sub ApplySecurity()
Worksheets("Master").Protect Password:="1225"
End Sub
I’d like to allow the user to a few basic things, such as select
locked/unlocked cells, use auto filter, and edit objects.
Sub ApplySecurity()
Worksheets("Master").Protect DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFiltering:=True Worksheets("Master").Protect
End Sub
How do I add the password in there? I’ve tried a couple things; I get only
errors.
In ThisWorkbook, I’ve got:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ApplySecurity
End Sub
Private Sub Workbook_Open()
Call ApplySecurity
End Sub
Thanks,
Ryan--