Class AllowEditRange (Excel VBA)
The class AllowEditRange represents the cells that can be edited on a protected worksheet. To use a AllowEditRange class variable it first needs to be instantiated, for example
Dim aer as AllowEditRange
Set aer = ActiveSheet.Protection.AllowEditRanges(Index:=1)
For Each
Here is an example of processing the AllowEditRange items in a collection.
Dim aer As AllowEditRange
For Each aer In ActiveSheet.Protection.AllowEditRanges
Next aer
ChangePassword
Changes the password for a range that can be edited on a protected worksheet.
ChangePassword (Password)
Password: The new password.
Dim strPassword As String: strPassword =
ActiveSheet.Protection.AllowEditRanges(1).ChangePassword Password:=strPassword
Delete
Deletes the object.
ActiveSheet.Protection.AllowEditRanges(1).Delete
Range
ActiveSheet.Protection.AllowEditRanges(1).Range =
Title
Returns or sets the title of the range of cells that can edited on a protected sheet.
ActiveSheet.Protection.AllowEditRanges(1).Title =
Unprotect
Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.
If you forget the password, you cannot unprotect the sheet or workbook. It's a good idea to keep a list of your passwords and their corresponding document names in a safe place.
Unprotect (Password)
Password: A string that denotes the case-sensitive password to use to unprotect the range of cells. If the range isn't protected with a password, this argument is ignored.
ActiveSheet.Protection.AllowEditRanges(1).Unprotect
Users
Returns a UserAccessList object for the protected range on a worksheet.
Dim ualUsers As UserAccessList
Set ualUsers = ActiveSheet.Protection.AllowEditRanges(1).Users