I am trying to automate a date of response column in excel from various user. I had updated the code basis some R&D from various blogs, but is stuck on one place. My code is given below. Same is able to record the date of change of a cell in next cell. And as I want only date of first update, it is doing fine. However, in case if user is removing the response, date is still there and thus "Target.Offset(0, 1).ClearContents" is not working. Kindly help to update the code.
My Requirement from the code as summarized as below:
- It should update date of change of cell in next cell (Offset (0,1))
- In case of multiple change of a cell, it only record first response date and should not overwrite previous date.
- when a user delete the response, date should also be removed. (Code will run in excel having approx. 2000 rows and approx. 10-20 of user will access the sheet.)
Dim xRg As Range, xCell As Range On Error Resume Next If (Target.Count = 1) Then If Not Intersect(Target, Application.ActiveSheet.Range("U:U,W:W,Y:Y,AA:AA,AC:AC,AE:AE,AG:AG,AI:AI")) Is Nothing Then Application.EnableEvents = False For Each xCell In xRg If VBA.IsEmpty(xCell.Value) Then If Target.Offset(0, 1) = "" Then Target.Offset(0, 1) = Now End If Else Target.Offset(0, 1).ClearContents End If Next Application.EnableEvents = True End If End If End Sub