AllowFormattingCells 属性

       

如果允许对受保护的工作表上的单元格进行格式设置,则返回 TrueBoolean 类型,只读。

expression.AllowFormattingCells

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

说明

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

使用该属性可禁用“保护”选项卡,从而允许用户更改所有格式,但不能取消对区域的锁定或隐藏。

示例

本示例允许用户对受保护的工作表上的单元格进行格式设置,并通知用户。

Sub ProtectionOptions()

    ActiveSheet.Unprotect

    ' Allow cells to be formatted on a protected worksheet.
    If ActiveSheet.Protection.AllowFormattingCells = False Then
        ActiveSheet.Protect AllowFormattingCells:=True
    End If

    MsgBox "Cells can be formatted on this protected worksheet."

End Sub