Hello,
I am asking you for help.
I have a macro that, when a cell in column 3, 4, or 5 is modified, inserts the modified date and username in the corresponding cell in columns A and B. The problem is that you can double-click the cell in column 3, 4, or 5 to the date and username have already appeared. How to modify a macro so that the date and username appear only after the actual modification of the cell.
Option Explicit
Private Sub WorkSheet_Change (ByVal Target As Range)
Dim and As Integer
i = Target.Row
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Then
Range ("A" & i) .Value = Environ ("Username")
End If
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Then
Range ("B" & i) .Value = Date & "" & Time ()
End If
End Sub
I am asking you for help.
I have a macro that, when a cell in column 3, 4, or 5 is modified, inserts the modified date and username in the corresponding cell in columns A and B. The problem is that you can double-click the cell in column 3, 4, or 5 to the date and username have already appeared. How to modify a macro so that the date and username appear only after the actual modification of the cell.
Option Explicit
Private Sub WorkSheet_Change (ByVal Target As Range)
Dim and As Integer
i = Target.Row
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Then
Range ("A" & i) .Value = Environ ("Username")
End If
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Then
Range ("B" & i) .Value = Date & "" & Time ()
End If
End Sub