Share via


Protection.AllowDeletingColumns Property

Excel Developer Reference

Returns True if the deletion of columns is allowed on a protected worksheet. Read-only Boolean.

Syntax

expression.AllowDeletingColumns

expression   A variable that represents 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.

Visual Basic for Applications
  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.<strong>AllowDeletingColumns</strong> = False Then
    ActiveSheet.Protect AllowDeletingColumns:=True
End If

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

End Sub

See Also