Hello,
I found your automated date entry to be extremely useful for my excel project.
The issue I found is when I delete the row, the date still updates in the cell/column.
I have a student information spreadsheet. If I delete a row, the next row moves up and the date is updated, but that's not what I want to do.
I want to clear the date if I delete the data in that row. Thank you!
Code_Goes_Here
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTableRange As Range
Dim myDateTimeRange As Range
Dim myUpdatedRange As Range
'Your data table range
Set myTableRange = Range("AA2:BI500")
'Check if the changed cell is in the data table or not.
If Intersect(Target, myTableRange) Is Nothing Then Exit Sub
'Stop events from running
Application.EnableEvents = False
'Column for the date/time
Set myDateTimeRange = Range("B" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange = Range("C" & Target.Row)
'Determine if the input date/time should change
If myDateTimeRange.Value = "" Then
myDateTimeRange.Value = Now
End If
'Update the updated date/time value
myUpdatedRange.Value = Now
'Turn events back on
Application.EnableEvents = True
End Sub
Code_Goes_Here
Thank you,
Erin Mills