problem change date based on change item

Hasson

Active Member
Joined
Apr 8, 2021
Messages
390
Office Version
  1. 2016
Platform
  1. Windows
hi guys

I search for way when I add item in cells into column A will add the date (today) in cells into column B ,and when I open the file tomorrow should be the old date has ever added . should not change based on date(today) . just if change the item in column A then should add date(today).

for instance if add in A2 = asd-100 then the date in B2 will be 6/27/2022 and if I open the file tommorrow keep the date 6/27/2022 not 6/28/2022

and if I change A2= asd-21 then automatically should add date(today).
I hope is clear .
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
The script will run when you enter any value in column 1
And the Date put in column 2 will never change.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  6/27/2022  7:43:17 AM  EDT
If Target.Column = 1 Then
Target.Offset(, 1).Value = Date
End If
End Sub
 
Upvote 0
thanks for taht and sorry I don't mentioned should be by formula
I have this formula
VBA Code:
=IF(A2<>"",TODAY(),"")
but doesn't work waht I look for
 
Upvote 0
You cannot do what you want with a formula.
 
Upvote 0
Nope, not if you want the date to change if A2 changes.
 
Upvote 0
@Fluff I no know if you understand my request . just if I change in A2 should be date(today) and if I open the file should keeping the date as yesterday without change to date(today). As long as the cell A2 is not changed then keep the old date without change it . is that impossible ?
 
Upvote 0
Do you want the date to change if the value in A2 changes?
 
Upvote 0
In that case you cannot use a formula.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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