MaunishP
Member
Hi Team,
I have a VBA code which allows me to double click and insert timestamp in Column K & L, however every time I insert data in K1&L1, it should get locked and no one should be able to edit data. However if i move to next row then I can enter data in K2&L2 and follow same process Lock --> Next Cell then K3&L3 and go on till last count.
Once cells are locked no one should be able to edit it or delete them. Every new row i should be able to insert timestamp and once timestamp is insert file use to get closed.
Below given is VBA code for double clicking time entry
I have a VBA code which allows me to double click and insert timestamp in Column K & L, however every time I insert data in K1&L1, it should get locked and no one should be able to edit data. However if i move to next row then I can enter data in K2&L2 and follow same process Lock --> Next Cell then K3&L3 and go on till last count.
Once cells are locked no one should be able to edit it or delete them. Every new row i should be able to insert timestamp and once timestamp is insert file use to get closed.
Below given is VBA code for double clicking time entry
Code:
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error Resume Next
Dim rng As Range
Set rng = Range("TimeEntry")
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, rng) Is Nothing Then
Application.EnableEvents = False
Cancel = True 'stop the edit mode
With Target
If .Value = "" Then
.Value = Time
.Offset(0, 1).Activate
End If
End With
End If
Application.EnableEvents = True
End Sub