Protect cells from other users w/out me having to enter pw

T

Tara at Walsh

I have an excel file on a network drive, other people view it. I changed the
protection so that they can only select and autofilter, but cannot edit
cells. However, I have to unprotect it for myself all the time and then I
save it forgetting to protect it again. There has to be an easier way so
that other people can't edit and I don't have to keep putting in password.
Right?
 
M

Mike

Right click on sheet1 Select View code
You will see ThisWorkbook double click then paste this
This will protect the workbook every time you close and you
can change "Password" to what you want password to be
Test on new workbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Replace "Password" with your password
'this will set password when closing workbook
ActiveSheet.Protect "Password", True
ActiveWorkbook.Protect "Password", True

End Sub
 
T

Tara at Walsh

Ummmm, I'm having a little trouble making this work. I copied the lines
exactly as they appear below into my code on the test sheet and it doesn't
seem to be working:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect "whoknows", True
ActiveWorkbook.Protect "whoknows", True
 
S

sahafi

Another way is to:

Select the range you would like to be protected.
On the Tools menu point to protection >> Allow users to edit ranges.
Click on 'New' make sure the right range is selected.
Next to 'Specify who may edit range without password' click the 'Permission'
button, then select or add your name.
Click on protect sheet (you can set a password if you wish).
Click OK.
No one will have permission to edit your sheet, but you can edit it any time
without having to enter a password.
h.t.h.
 
M

Mike

Be sure toput the code into ThisWorkbook Module and Not sheet Module
Sould work

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Protect "whoknows", True
ActiveWorkbook.Protect "whoknows", True
End Sub
 
Top