I am working on creating a log that will automatically populate a timestamp into Cell D, when data is initially entered into Cell C. Unfortunately I have hit a wall.
When I enter data in Cell C, I am able to get the timestamp in Cell D, but if I make any changes to Cell C, the timestamp updates again.
I need to make it function so that the timestamp will ONLY change in Cell D if Cell C is blank.
If data already has been entered into Cell C, and a timestamp already has been loaded to Cell D, and I need to modify what's in cell C, I don't want the timestamp Cell D to change.
Hope that makes sense. VBA code is as follows:
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim rCell As Range Dim rChange As Range On Error GoTo ErrHandler Set rChange = Intersect(Target, Range("C:C")) If Not rChange Is Nothing Then Application.EnableEvents = False For Each rCell In rChange If rCell > "" Then With rCell.Offset(0, 1) .Value = Now .NumberFormat = "hh:mm:ss AM/PM mm/dd/yyyy" End With Else rCell.Offset(0, 1).ClearContents End If Next End If ExitHandler: Set rCell = Nothing Set rChange = Nothing Application.EnableEvents = True Exit Sub ErrHandler: MsgBox Err.Description Resume ExitHandler End Sub
Any guidance would be appreciated.