User AccessList Object Example

The following routine loops through all of the AllowEditRange objects on a specified worksheet and removes all of the users except for the range pcNetSales:

Sub DeleteAllUsers()

Dim oAllowRange As AllowEditRange

'Loop through all AllowEditRange objects on the active sheet For Each oAllowRange In ActiveSheet.Protection.AllowEditRanges

'Remove all names from all AllowEditRanges

'except for the range whose AllowEditRange Title is pcNetSales If oAllowRange.Title <> "pcNetSales" Then oAllowRange.Users.DeleteAll End If Next oAllowRange End Sub

0 0

Post a comment