Setting up protection on a workbook

  • Thread starter Thread starter brown1965
  • Start date Start date
B

brown1965

I am setting up a workbook and I am wondering if you can put protection on it
to prevent some users from inserting / deleting rows but allow other users
(people that will be doing maintenance on the file) to delete / insert rows
without having to remove the protection every time?
 
You should simply use password protection, but if you want to avoid the
manual effort of disabling and then re-enabling protection, you can use the
workbook open event macro:

Private Sub Workbook_Open()
If Environ("username") = "James" Then
' clear desired workbook and worksheet protections
Else
' set desired workbook and worksheet protections
End If
End Sub

or something similar
 
Hi,

The answer to this question might be more complicated if you are 1. Only
trying to allow the users to insert and delete rows, 2. If different users
can work with different ranges only.

In the second case you might consider the Tools, Protection, Allow Users to
edit range option.

In the first case you should consider VBA which prompts users for a password
or logon name and then sets the protection to allow only inserting and
deleting rows. With this routine you will need to add a before save or
before close macro which resets the protection back to complete.

If the users who can modify the workbook can make any modifications and
those that can't, can't make any modifications, then you might consider Read
Only with a password.
 
Back
Top