AllowDeletingColumns 属性

       

如果允许删除受保护的工作表上的列,则返回 TrueBoolean 类型,只读。

expression.AllowDeletingColumns

expression   必需。该表达式返回一个 Protection 对象。

说明

可用 Protect 方法的参数设置 AllowDeletingColumns 属性。

对于受保护的工作表,必须取消对包含要删除的单元格的列的锁定。

示例

本示例取消对受保护的工作表上的列 A 的锁定,然后允许用户删除列 A 并通知用户。

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