AllowEdit Property

Microsoft Excel Visual Basic

Show All

AllowEdit Property

       

AllowEdit property as it applies to the UserAccess object.

True if the user is allowed access to the specified range on a protected worksheet. Read/write Boolean.

expression.AllowEdit

expression   Required. An expression that returns a UserAccess object.

AllowEdit property as it applies to the Range object.

True if the range can be edited on a protected worksheet. Read-only Boolean.

expression.AllowEdit

expression   Required. An expression that returns a Range object.

Example

As it applies to the Range object.

In this example, Microsoft Excel notifies the user if cell A1 can be edited or not on a protected worksheet.

Sub UseAllowEdit()

    Dim wksOne As Worksheet

    Set wksOne = Application.ActiveSheet

    ' Protect the worksheet
    wksOne.Protect

    ' Notify the user about editing cell A1.
    If wksOne.Range("A1").AllowEdit = True Then
        MsgBox "Cell A1 can be edited."
    Else
        Msgbox "Cell A1 cannot be edited."
    End If

End Sub