I'm not sure if you want to do this from code or from Excel but as this is a VBA forum lets assume it is code. In that case select the cell tou want to lock and the following 2 lines of code should do the trick
Selection.Locked = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
If you want to do it from Excel just lock the cell using the menu Format|Cells... then select the Protection tab and ensure the Locked tickbox is checked. Then use the Tools|Protection|Protect Sheet... menu to protect the sheet and any locked cells will be locked against alteration.
Cheers
nic
|