Dec 08 2022 07:17 AM
Is there a way (to have one cell on the top of a row) track the date that a change was made in that row? Or is there away to limit the "NOW" function to a few select cells? For example, =if( there there is a change in C4, =NOW, "")
Or can I place =NOW in A1. and in A2 I will put =IF(NOT(C4="", copy current reading of A1,"")
Dec 08 2022 07:40 AM
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngBereich As Range
Application.EnableEvents = False
Set rngBereich = Range("A2:G2")
If Target.Cells.Count > 1 Then GoTo done
If Not Application.Intersect(Target, rngBereich) Is Nothing Then
If Target.Value <> "" Then
Range("A1").Value = Now
Else
End If
End If
done:
Application.EnableEvents = True
Exit Sub
End Sub
You can try this code. In the attached file you can make a change in any cell in range A2:G2 and the current time is entered in cell A1.
Dec 12 2022 09:19 AM
Dec 12 2022 09:53 AM
SolutionPrivate Sub Worksheet_Change(ByVal Target As Range)
Dim rngBereich As Range
Dim j As Long
Application.EnableEvents = False
Set rngBereich = Range("A2:XFD1048576")
If Target.Cells.Count > 1 Then GoTo done
If Not Application.Intersect(Target, rngBereich) Is Nothing Then
If Target.Value <> "" Then
j = Target.Column
Cells(1, j).Value = Now
Else
End If
End If
done:
Application.EnableEvents = True
Exit Sub
End Sub
You can try this code. In the attached file you can enter data in any cell in range A2:XFD1048576. The code then determines the column of the target cell and enters the current day and time in row 1 of the target column.