Worksheet.Protection プロパティ (Excel)

ワークシートの保護オプションを表す Protection オブジェクトを返します。

構文

保護

Worksheet オブジェクトを表す変数。

次の使用例は、アクティブ ワークシートを保護し、保護したワークシートに列を挿入できるかどうかを調べて、その状態を表示します。

Sub CheckProtection() 
 
 ActiveSheet.Protect 
 
 ' Check the ability to insert columns on a protected sheet. 
 ' Notify the user of this status. 
 If ActiveSheet.Protection.AllowInsertingColumns = True Then 
 MsgBox "The insertion of columns is allowed on this protected worksheet." 
 Else 
 MsgBox "The insertion of columns is not allowed on this protected worksheet." 
 End If 
 
End Sub

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。