Forum Discussion

Jennifer Clark's avatar
Jennifer Clark
Copper Contributor
Apr 23, 2018
Solved

IF Statement Concerns

I am trying to get the date/time that a cell changes but not have it autoupdate....   Using this: =IF(B2 <> "",NOW(),"Not Checked Out") works until you update the next row an hour later then everyt...
  • IngeborgHawighorst's avatar
    Apr 24, 2018

    Hello,

     

    what you want to achieve cannot be done with the NOW() formula. It will always update to the current date and time. If you want a time stamp that does not change, then you will need to use VBA. 

     

    This code will put a time stamp into column B when a cell in column A is changed by the user. Copy the code, then right-click the Sheet, select "View code" and paste the code into the code window.

     

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Target.Offset(0, 1) = Now
    End If
    End Sub

     

Resources