Protection.AllowEditRanges Property (Excel)

Returns an AllowEditRanges object.

expression .AllowEditRanges

expression A variable that represents a Protection object.

In this example, Microsoft Excel allows edits to range A1:A4 on the active worksheet and notifies the user of the title and address of the specified range.

Sub UseAllowEditRanges() 
 Dim wksOne As Worksheet 
 Dim strPwd1 As String 
 Set wksOne = Application.ActiveSheet 
 strPwd1 = InputBox("Enter Password") 
 ' Unprotect worksheet. 
 ' Establish a range that can allow edits 
 ' on the protected worksheet. 
 wksOne.Protection.AllowEditRanges.Add _ 
 Title:="Classified", _ 
 Range:=Range("A1:A4"), _ 
 ' Notify the user 
 ' the title and address of the range. 
 With wksOne.Protection.AllowEditRanges.Item(1) 
 MsgBox "Title of range: " & .Title 
 MsgBox "Address of range: " & .Range.Address 
 End With 
End Sub
© 2014 Microsoft