Share via


AllowEditRanges.Item Property

Excel Developer Reference

Returns a single object from a collection.

Syntax

expression.Item(Index)

expression   A variable that represents an AllowEditRanges object.

Parameters

Name Required/Optional Data Type Description
Index Required Variant The name or index number of the object.

Example

This example allows edits to range ("A1:A4") on the active worksheet, notifies the user, then changes the password for this specified range and notifies the user of this change.

Visual Basic for Applications
  Sub UseChangePassword()
Dim wksOne As Worksheet

Set wksOne = Application.ActiveSheet

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

MsgBox "Cells A1 to A4 can be edited on the protected worksheet."

' Change the password.
wksOne.Protection.AllowEditRanges.<strong>Item</strong>(1).ChangePassword _
    Password:="moresecret"

MsgBox "The password for these cells has been changed."

End Sub

See Also