Class AllowEditRanges (Excel VBA)
A collection of all the AllowEditRange objects that represent the cells that can be edited on a protected worksheet. To use a AllowEditRanges class variable it first needs to be instantiated, for example
Dim aers as AllowEditRanges
Set aers = ActiveSheet.Protection.AllowEditRanges
For Each
Here is an example of processing the AllowEditRanges items in a collection.
Dim aer As AllowEditRange
For Each aer In ActiveSheet.Protection.AllowEditRanges
Next aer
Add
Adds a range that can be edited on a protected worksheet. Returns an AllowEditRange object.
Dim strTitle As String: strTitle =
Dim aer As AllowEditRange
Set aer = ActiveSheet.Protection.AllowEditRanges.Add(Title:=strTitle, Range:=)
Arguments
The following arguments are required:
Title (String) - The title of the range.
Range (Range) - Range object. The range allowed to be edited.
Optional arguments
The following argument is optional
Password (String) - The password for the range.
Count
Returns a Long value that represents the number of objects in the collection.
Dim lngCount As Long
lngCount = ActiveSheet.Protection.AllowEditRanges.Count
Item
Returns a single object from a collection.
Item (Index)
Index: The name or index number of the object.
Dim aerItem As AllowEditRange
Set aerItem = ActiveSheet.Protection.AllowEditRanges(Index:=1)