Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Protection Property

Protection Property

Office 2003

Returns a Protection object that contains the protection properties for the specified worksheet. The protection properties are ignored if the Enabled property is set to False.

expression.Protection

expression    Required. An expression that returns a Worksheet object.

Example

This example locks the cells in column B and enables protection for the sheet.

Sub ProtectColumnB()

   ' Unlock all of the cells in the active sheet.
   Spreadsheet1.ActiveSheet.Cells.Locked = False

   ' Lock the cells in column B.
   Spreadsheet1.Columns(2).Locked = True

   ' Protect the locked cells.
   Spreadsheet1.ActiveSheet.Protection.Enabled = True

End Sub

		


Applies to | Worksheet Object



Show:
© 2015 Microsoft