Locked Property

Microsoft Excel Visual Basic

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.

ShowLocked 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

ShowAs 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