User permissions for ranges

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way, programmatically, to set user permissions for a range?

Basically, I want to use the functionality that exists when I go to:

Tools / Protection / Allow Users to Edit Ranges ...
Then, when I click on the "Permissions" Button, I can add a user or group.

The assigned user or group then has permissions to modify the range without
a password.

Thank you, in advance, for your help.
 
Turn on the macro recorder (Tools menu, Macro, Record new macro)
while you set permissions, and you'll see the code to do what you
want.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thank you for your input.

Actually, though, that was the first thing I tried before making this
posting. It didn't record anything pertinent. I believe the commands are
nested too far into the Excel dialog boxes, that the recorder does not record
what I am setting.

Here is what it recorded:

Sub ProtectSheetsMacro()
ActiveSheet.Protection.AllowEditRanges.Add Title:="Testing",
Range:=Cells, _
Password:="tennis"
End Sub

Please reply with any other ideas.
 
Back
Top