Working With Worksheets

VBA provides different properties that you can use with worksheet and chart objects to determine if parts of a sheet are protected. Doing this helps to eliminate errors caused by attempting to modify a protected sheet. Each of these properties are read-only, meaning you can only use them to determine if the sheet has that type of protection.

PROPERTY

DESCRIPTION

ProtectContents

Returns a value of True if the sheet is protected. For a chart, the property looks to see if the entire chart is protected. For a worksheet, the property looks to see if the cells are protected. To turn off this property, set the Contents parameter of the Protect method to False.

ProtectDrawingObjects

Returns a value of True if the drawing shapes that were added to the sheet are protected. To turn off this property, set the DrawingObjects parameter of the Protect method to False.

ProtectScenarios

Returns a value of True if the scenarios are protected. To turn off this property, set the Scenarios parameter of the Protect method to False.

ProtectionMode

Returns a value of True if the user-interface is protected.

0 Specify any other parameters needed to protect the chart.

■ Excel no longer allows modifications to the chart.

< Type Password:="Excel", replacing "Excel" with the password you want to use to unprotect the chart.

—Q Type DrawingObjects:=False.

0 Specify any other parameters needed to protect the chart.

■ Excel no longer allows modifications to the chart.

0 0

Post a comment