PDA

View Full Version : protect a sheet



lior03
07-12-2006, 04:58 AM
hello
i want to enable a user change data on a sheet but not formulas.

Dim cell As Range
For Each cell In ActiveSheet.UsedRange
With ActiveSheet
.Unprotect
If cell.HasFormula Then
cell.Locked = True
Else
cell.Locked = False
ActiveSheet.Protect
End If
End With
Next


is it possible to do it?
thanks

Bob Phillips
07-12-2006, 05:30 AM
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
With ActiveSheet
.Unprotect
cell.Locked = cell.HasFormula
.Protect
End With
Next