UserAccessList.DeleteAll Method

Excel Developer Reference

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

Syntax

expression.DeleteAll

expression   A variable that represents a UserAccessList object.

Example

In this example, Microsoft Excel removes all users that have access to the first protected range on the active worksheet. This example assumes the worksheet is not protected.

Visual Basic for Applications
  Sub UseDeleteAll()
Dim wksSheet As Worksheet

Set wksSheet = Application.ActiveSheet

' Remove all users with access to the first protected range.
wksSheet.Protection.AllowEditRanges(1).Users.DeleteAll

End Sub

See Also