Protection プロパティ
Office web コンポーネント Visual Basic リファレンス |
Protection プロパティ
指定したワークシートの保護プロパティを含む Protection オブジェクトを取得します。Enabled プロパティに False が設定されていると、この保護プロパティは無視されます。
expression.Protection
*expression * 必ず指定します。Worksheet オブジェクトを表すオブジェクト式を指定します。
使用例
次の使用例は、列 B のセルをロックし、シートの保護を有効にします。
Sub ProtectColumnB()
' 作業中のシートの全てのセルのロックを解除します。
Spreadsheet1.ActiveSheet.Cells.Locked = False
' 列 B のセルをロックします。
Spreadsheet1.Columns(2).Locked = True
' ロックされたセルを保護します。
Spreadsheet1.ActiveSheet.Protection.Enabled = True
End Sub