UserAccessList.DeleteAll method (Excel)

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 that the worksheet is not protected.

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

Support and feedback

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.