Formula to add the date of the day the row is filled

Dosce

New Member
Joined
Feb 12, 2020
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a sheet where I keep track of some stuff, it look like that :

DateABC
20/02/2023StuffValueValue
22/02/2023StuffValueValue
22/02/2023StuffValueValue
23/02/2023StuffValueValue

I would like to find a formula to put in the "Date" column, so that when I type something in the A column in a new row, the date I am typing is automatically filled in the first column.

I tried with TODAY(), but then when I use a new row, all the dates for the first column are updated to the new day, so that is not good.

Would you have any idea ?

Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I would like to find a formula to put in the "Date" column, so that when I type something in the A column in a new row, the date I am typing is automatically filled in the first column.
If you are typing stuff into column A (note that column A is the first column), then how can you put a date into the first column? It would overwrite your entry?
Which columns are you really typing into, and which column do you really want updated?

I tried with TODAY(), but then when I use a new row, all the dates for the first column are updated to the new day, so that is not good.
The TODAY() function will always return the current date. So tomorrow, all cells that have TODAY() in it will show the new date.
What you are talking about is a Date Stamp, and usually requires VBA. There are literally thousands of posts on the topic here (this question gets asked multiple times a week).
You can either search for past posts on the topic to see how it is done, or if you clarify the question above, we can tailor something to your requirements.
 
Upvote 0
Use worksheet event code
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2:A2000")) Is Nothing Then
Application.EnableEvents = False
If Target <> "" Then Range("A" & Target.Row) = Date
Application.EnableEvents = True
End If
End Sub
How to use workheet event the code
Right click on Sheet tab --> view code
Visual Basic (VB) window opens.
Paste the code
Close the VB window.
Save the file as .xlsm
 
Upvote 0
Oh yes my choice of column names is very bad, sorry.

ABCD
20/02/2023StuffValueValue
22/02/2023StuffValueValue
22/02/2023StuffValueValue
23/02/2023StuffValueValue

Thank you for the name timestamp, now I am finding results, I could not find any answer before.

@kvsrinivasamurthy , your VBA almost works, I would need the date to be in the column A when stuff is entered in column B, whereas as for now with your code the date shows in column A when I type in column A
 
Upvote 0
Modified code:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B2:B2000")) Is Nothing Then
Application.EnableEvents = False
If Target <> "" Then Range("A" & Target.Row) = Date
Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Solution
That is awesome, thank you !

I would also need the same thing for Google sheets, will the code be the same ?
 
Upvote 0
Note that all Google Sheets questions should be posted to the "General Discussion & Other Applications" forum:

1677516796879.png
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top