UserAccess object (Excel)
Represents the user access for a protected range.
Use the Add method or the Item property of the UserAccessList collection to return a UserAccess object.
After a UserAccess object is returned, you can determine if access is allowed for a particular range on a worksheet by using the AllowEdit property.
The following example adds a range that can be edited on a protected worksheet and notifies the user of the title of that range.
Sub UseAllowEditRanges()
Dim wksSheet As Worksheet
Set wksSheet = Application.ActiveSheet
' Add a range that can be edited on the protected worksheet.
wksSheet.Protection.AllowEditRanges.Add "Test", Range("A1")
' Notify the user the title of the range that can be edited.
MsgBox wksSheet.Protection.AllowEditRanges(1).Title
End Sub
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.