Forum Discussion
Automatically adding the date/time to a cell when another cell is updated
Hi Joseph,
This is possible, but you definitely need to a VBA code to do it!
Let's say the five cells you want to target are from cell A1 to E1, so please hover the Mouse over the Worksheet tab, right-click, and select View Code.
Then copy and paste this code into the worksheet code module:
Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Or _
Not Intersect(Target, Range("B1")) Is Nothing Or _
Not Intersect(Target, Range("C1")) Is Nothing Or _
Not Intersect(Target, Range("D1")) Is Nothing Or _
Not Intersect(Target, Range("E1")) Is Nothing Then
Target.Offset(1, 0) = Now
End If
End Sub
After that, save the workbook as .xlsm file extension to keep the code saved in it.
If you want to apply it to different cells, simply, you can change the cell ranges in the code and their order in the code does not matter!.
Hope that helps
Haytham Amairah I want to be able to type a date in one cell and have it appear in another cell. It just two cells involved. How can I do this please?
- HansVogelaarNov 09, 2022MVP
Let's say you want to type a date in A2 on Sheet1 and you want it to appear in D3 on another sheet.
Format D3 the way you want, and enter the following formula in that cell:
=IF(Sheet1!A2="", "", Sheet1!A2)