This topic has not yet been rated - Rate this topic

Locked Property

Office 2003

True if all cells in the specified range are locked, False if none of the cells are locked, and Null if some cells are locked and some are not. The default value is True. Use the IsNull function to determine whether the return value is Null. Read/write Variant.

expression.Locked

expression    Required. An expression that returns a Range object.

Example

This example locks only the cells in column B on the active sheet in Spreadsheet1 and then protects the worksheet.

Sub LockColumnB()
    Dim shtCurrent
    
    Set shtCurrent = Spreadsheet1.ActiveSheet
    
    ' Clear the locked attribute for all cells on the active sheet.
    shtCurrent.Cells.Locked = False
    
    ' Lock all of the cells in Column B.
    shtCurrent.Columns(2).Locked = True
    
    ' Enable protection on the active sheet.
    shtCurrent.Protection.Enabled = True
End Sub

		


Applies to | Range Object



Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.