如果允许在受保护的工作表上进行排序选择,则返回 True。Boolean 类型,只读。
expression.AllowSorting
expression 必需。该表达式返回一个 Protection 对象。
在受保护的工作表中,只能对未锁定或未保护的单元格进行排序。
可用 Protect 方法的参数设置 AllowSorting 属性。
本示例允许用户对受保护的工作表上未锁定或未保护的单元格进行排序,并通知用户。
Sub ProtectionOptions()
    ActiveSheet.Unprotect
    ' Unlock cells A1 through B5.
    Range("A1:B5").Locked = False
    ' Allow sorting to be performed on the protected worksheet.
    If ActiveSheet.Protection.AllowSorting = False Then
        ActiveSheet.Protect AllowSorting:=True
    End If
    MsgBox "For cells A1 through B5, sorting can be performed on the protected worksheet."
End Sub