Class UserAccessList (Excel VBA)

A collection of UserAccess objects that represents the user access for protected ranges. To use a UserAccessList class variable it first needs to be instantiated, for example


Dim ual as UserAccessList
Set ual = ActiveSheet.Protection.AllowEditRanges(1).Users

Add

Adds a user access list.

Add (Name, AllowEdit)


Dim strName As String: strName = 
Dim usrac As UserAccess
Set usrac = ActiveSheet.Protection.AllowEditRanges(1).Users.Add(Name:=strName, AllowEdit:=True)

Arguments

The following arguments are required:

Name (String) - The name of the user access list.

AllowEdit (Boolean) - True allows users on the access list to edit the editable ranges on a protected worksheet.

Count

Returns a Long value that represents the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveSheet.Protection.AllowEditRanges(1).Users.Count

DeleteAll

Removes all users who have access to a protected range on a worksheet.


ActiveSheet.Protection.AllowEditRanges(1).Users.DeleteAll

Item

Returns a single UserAccess object from the collection.

For more information about returning a single member of a collection, see Returning an object from a collection.

Item (Index)

Index: The name or index number of the object.


Dim usracItem As UserAccess
Set usracItem = ActiveSheet.Protection.AllowEditRanges(1).Users(Index:=1)