Locked Property

Microsoft Excel Visual Basic

Show All

Locked Property

       

Locked property as it applies to the ChartObject, ChartObjects, LinkFormat, OLEObject, OLEObjects, Scenario, Shape, and Style objects.

True if the object is locked, False if the object can be modified when the sheet is protected. Read/write Boolean.

expression.Locked

expression   Required. An expression that returns one of the above objects.

Locked property as it applies to the CellFormat and Range objects.

True if the object is locked, False if the object can be modified when the sheet is protected. Returns Null if the specified range contains both locked and unlocked cells. Read/write Variant.

expression.Locked

expression   Required. An expression that returns one of the above objects.

Example

As it applies to the CellFormat and Range objects.

This example unlocks cells A1:G37 on Sheet1 so that they can be modified when the sheet is protected.

Worksheets("Sheet1").Range("A1:G37").Locked = False
Worksheets("Sheet1").Protect