ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User permissions for ranges (https://www.excelbanter.com/excel-programming/367005-user-permissions-ranges.html)

dalbin

User permissions for ranges
 
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.

Chip Pearson

User permissions for ranges
 
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


"dalbin" wrote in message
...
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.




dalbin

User permissions for ranges
 
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.

"Chip Pearson" wrote:

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


"dalbin" wrote in message
...
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.






All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com