When you protect a worksheet, the behaviour in each cell is defined by the Locked
property. Sample code:
ActiveSheet.Unprotect
ActiveSheet.Range("A1").Locked = False
ActiveSheet.Range("A2").Locked = True
ActiveSheet.Protect
ActiveSheet.EnableSelection = xlNoRestrictions 'All the cells can be selected
With this code, users can edit cell A1
but not cell A2
. Bear in mind that, by default, the Locked
property is set to True
.
CLARIFICATION
Protection is applied to the whole worksheet. At the cell level, all what you can do is relying on the Locked
property. What you cannot get is different behaviours for different (Locked/Unlocked) ranges.