UserAccessList Collection

Microsoft Excel Visual Basic

UserAccessList Collection

         
AllowEditRange UserAccessList
UserAccess

A collection of UserAccess objects that represent the user access for protected ranges.

Using the UserAccessList Collection

Use the Users property of the ProtectedRange object to return a UserAccessList collection.

Once a UserAccessList collection is returned you can use the Count property to determine the number of users that have access to a protected range. In the following example, Microsoft Excel notifies the user the numbers users that have access to the first protected range. This example assumes that a protected range exists on the active worksheet.

Sub UseDeleteAll()

    Dim wksSheet As Worksheet

    Set wksSheet = Application.ActiveSheet

    ' Notify the user the number of users that can access the protected range.
    MsgBox wksSheet.Protection.AllowEditRanges(1).Users.Count

End Sub