Example

Use the property of the protected object to return a UserAccessList collection.

Once a UserAccessList collection is returned you can use the 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.

Visual Basic for Applications
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

See also: