MAKE CELL LOCKED


Posted by Michael on February 04, 2002 4:29 AM

Is there a way VBA or other wise of making a cell locked once data has been entered in to it for the first time?

Thanks



Posted by DK on February 04, 2002 4:37 AM

Hi,

Yes there is. First set up your worksheet with the cells that can be changed as Unlocked (Format, Cells, Protection). Then protect your worksheet with a password (this example uses 'password'). Then right click the worksheet tab and choose View Code. Paste this:-

Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect "password"
Target.Locked = True
Me.Protect "password"
End Sub

It's not foolproof but it's a start,

Any probs let me know,
D