Setting up protection on a workbook

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?
 
G

Gary''s Student

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
 
S

Shane Devenshire

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top