[Excel] automatic date without updating

bob -  
 tito -
Hello,

I'm looking to timestamp today's date in B1 as soon as A1 is filled. The formula =IF(A1=""; ""; TODAY()) in B1 works great, but when I reopen the file the next day, the date updates, which I don't want.
How can I keep this information fixed from one day to the next?
When I use Ctrl ; instead of the formula, it works very well and stays static over time, but I would like a more "automatic" solution than Ctrl ;.

Thank you
Best regards
Bob

6 answers

  1. JvDo Posted messages 1924 Registration date   Status Member Last intervention   859
     
    Hello,

    would an event macro work for you?
    Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then If Not (IsEmpty(Target.Value)) Then Range("B1").Value = Now Else Range("B1").ClearContents End Sub
    to put behind your worksheet

    best regards
    12
    1. bob
       
      Thank you,

      that answers half of my question. :-D
      Actually, I would like to propagate this rule to columns A and B.
      Let me explain:
      If I enter a value in A1, then B1 takes today's date.
      If I enter a value in A2, then B2 takes today's date.
      ...
      If I enter a value in An, then Bn takes today's date.

      How can I modify your event macro to achieve this?

      Best regards
      Bob
      0
    2. thalys
       
      I just want to put the year by itself without the day or month.
      0
    3. tito
       
      thank you
      0