AllowDeletingColumns Property

Microsoft Excel Visual Basic

expression.AllowDeletingColumns

expression    Required. An expression that returns a Protection object.

Remarks

The AllowDeletingColumns property can be set by using the Protect method arguments.

The columns containing the cells to be deleted must be unlocked when the sheet is protected.

Example

This example unlocks column A then allows the user to delete column A on the protected worksheet and notifies the user.

Sub ProtectionOptions()

    ActiveSheet.Unprotect

    'Unlock column A.
    Columns("A:A").Locked = False

    ' Allow column A to be deleted on a protected worksheet.
    If ActiveSheet.Protection.AllowDeletingColumns = False Then
        ActiveSheet.Protect AllowDeletingColumns:=True
    End If

    MsgBox "Column A can be deleted on this protected worksheet."

End Sub