(Excel) 的 Protection.AllowSorting 屬性
如果允許使用者在受保護工作表上使用排序選項,則會傳回 True。 唯讀的 Boolean。
語法
運算式。AllowSorting
表達 代表 Protection 物件的變數。
註解
在受保護工作表上,您只能在未鎖定或未保護的儲存格進行排序。
AllowSorting屬性可以使用Protect方法引數來設定。
範例
本範例允許使用者在受保護工作表上,對未鎖定或未保護的儲存格進行排序,並通知使用者。
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
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。