Jitu Marathe
New Member
- Joined
- Mar 20, 2013
- Messages
- 6
Hii, Gyus
I am using following codes for current time and current date in sheets,
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 2 And Target.Column <> 5 Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, -1).Value = Date
Target.Offset(0, 1).Value = Now - Date
Range("G5:G60").Formula = "=IF(OR(RC[-1]="""",RC[-4]=""""),"""",RC[-1]-RC[-4])"
Application.EnableEvents = True
End Sub
Now,I want to auto lock and protection to all the cells once data Entry into any cell so what no one can edit the Cells.
Pls suggest what modification is required in above codes.
I am using following codes for current time and current date in sheets,
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 2 And Target.Column <> 5 Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, -1).Value = Date
Target.Offset(0, 1).Value = Now - Date
Range("G5:G60").Formula = "=IF(OR(RC[-1]="""",RC[-4]=""""),"""",RC[-1]-RC[-4])"
Application.EnableEvents = True
End Sub
Now,I want to auto lock and protection to all the cells once data Entry into any cell so what no one can edit the Cells.
Pls suggest what modification is required in above codes.