Protection.AllowDeletingColumns property (Excel)

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, and then allows the user to delete column A on the protected worksheet.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.