write at exceltoexplore@gmail.com : Report Automation|Dashboard in Excel| Provide Excel consulting through macro (VBA) automation |Financial Modeling | Ethical Hacking

Wednesday, 10 August 2011

Lock cell once you enter data

1.First select all cells (Ctrl + A) on worksheet
2.Right Click & Go to Format cells
3.Select Protection Tab
4.uncheck Locked
5.Right Click on sheet tab & select view code
6.Paste below code
Private Sub Worksheet_Change(ByVal Target As Range)
Const pw As String = "password"
With Me
.Unprotect pw
 Target.Locked = True
.Protect pw
End With
End Sub

No comments:

Post a Comment