Share via


AllowEditRanges Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns an AllowEditRanges object.

expression.AllowEditRanges

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

Example

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

    Set wksOne = Application.ActiveSheet

    ' Unprotect worksheet.
    wksOne.Unprotect

    ' Establish a range that can allow edits
    ' on the protected worksheet.
    wksOne.Protection.AllowEditRanges.Add _
        Title:="Classified", _
        Range:=Range("A1:A4"), _
        Password:="secret"

    ' 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