EnableSelection Property

Applies To

Worksheet object.

Description

Returns or sets what can be selected on the sheet. Can be one of the following XlEnableSelection constants: xlNoRestrictions, xlNoSelection, or xlUnlockedCells. Read/write Long.

Remarks

This property takes effect only when the worksheet is protected: xlNoSelection prevents any selection on the sheet, xlUnlockedCells allows only those cells whose Locked property is False to be selected, and xlNoRestrictions allows any cell to be selected.

See Also

Protect method.

Example

This example sets worksheet one so that nothing on it can be selected.

With Worksheets(1)
    .EnableSelection = xlNoSelection
    .Protect Contents:=True, UserInterfaceOnly:=True
End With