DeleteAll Method

Microsoft Excel Visual Basic

expression.DeleteAll

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

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

Sub UseDeleteAll()

    Dim wksSheet As Worksheet

    Set wksSheet = Application.ActiveSheet

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

End Sub