Forum Discussion

Buildit's avatar
Buildit
Copper Contributor
Jan 16, 2026

Current Date and time per cell

I have a table with one column listing rows with a dynamic text box (open; closed) in the next column I would like to display the date and time when the status changes.

The purpose is to show when a task was completed, I have used the now() function but it keeps refreshing, I need it stay the date

The snip of the sheet below shows how is is currently working, so can any one help with some code for column J please.

 

thank you

Lee

 

 

 

4 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    This is a classic Excel requirement, and you’ve already discovered the key limitation:

    NOW() and TODAY() are volatile → they will always recalculate.

    To freeze date/time when a status changes, you must use VBA. There is no formula-only solution that is reliable.

    Below is the correct, minimal, production-safe VBA pattern for exactly your case.

    Paste this code into the worksheet module

    Double-click the sheet name (not a standard module).

    VBA Code (FIFO-safe, fast, robust)

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        ' Watch column I only
        If Intersect(Target, Me.Columns("I")) Is Nothing Then Exit Sub
        If Target.CountLarge > 1 Then Exit Sub
    
        Application.EnableEvents = False
    
        ' If status becomes Closed, stamp date/time
        If LCase(Target.Value) = "closed" Then
            If Me.Cells(Target.Row, "J").Value = "" Then
                Me.Cells(Target.Row, "J").Value = Now
            End If
    
        ' Optional: clear timestamp if reopened
        ElseIf LCase(Target.Value) = "open" Then
            Me.Cells(Target.Row, "J").ClearContents
        End If
    
        Application.EnableEvents = True
    
    End Sub

    Result

    Status

    Date Closed

    Open

    (blank)

    Closed

    2026-01-17 14:36:16

    Closed

    2026-01-18 09:12:03

    No refreshing
    No recalculation
    Audit-safe
    Works forever

    You want to keep timestamp even if reopened?

    Remove this block:

    ElseIf LCase(Target.Value) = "open" Then

        Me.Cells(Target.Row, "J").ClearContents

    End If

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

     

    Was the answer useful? Mark as best response and like it!

    This will help all forum participants.

  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor

    You need VBA coding to stay date. NOW() function will change the date/time once the cell is recalculated.

  • Lobo360's avatar
    Lobo360
    Brass Contributor

     

    You require a logic test that applies the Now() stamp when the criteria is met - a fresh change to “Closed” in the monitored cell - but when not met leaves the check cell as it was.


    Solution:

    =if(AND(i9=“Closed”,Cell(“address”,i9)=Cell(“address”)),Now(),j9)

    Based on:

    Date of Last Modified for a Cell | Microsoft Community Hub

    This requires iterative calculation setting to be turned on, details of which can be found in the thread linked above. 

    I have assumed that the cell update test { Cell(“address”,i9)=Cell(“address”) } will work for a dynamically updated rather than user updated cell - this needs to be tested. 

    • Lobo360's avatar
      Lobo360
      Brass Contributor

      I have tested and unfortunately this does not work for dynamically updated cells as it doesn’t register with the Cell(“address”) function. It does work for manually updated cells though. 

Resources