Attached a screen shot.
Column H has a drop down for F / P
If F selected column K reads Fail
If P selected, column K reads Today's date.
Formula = =IF(H14= "P", NOW(), IF(H14= "F", "Fail", IF(H14="-","No Run")))
However, if I open the sheet tomorrow, that date changes !
How can I get it to read the date when P is selected, and keep it that way any time I re open the file?
Oceans Blue
I believe the NOW function is always volatile, but you could perhaps make a macro to copy that column and then paste as values.
Creating a Macro is way too much work. Not that I know how to do that.
So no other way around it i guess !
Oceans Blue
There is no other way. Right click on the sheet tab and choose "View Code". Paste this code into the text box in VBA EditorClose VBA EditorPrivate Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("H12:H100")) Is Nothing Then Exit Sub If Target = "P" Then Target.Offset(0, 3).Value = Now() If Target = "F" Then Target.Offset(0, 3).Value = "Fail" End Sub
Does that work for you?
ChemistB
My 2¢
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
Thanks a million.
This works, I tested by changing the machine time and date.
Can you be a sport and guide me to a site where I can learn more of VB for excel please !
Oceans Blue
http://www.excelforum.com/excel-gene...additions.html
Chalk full of good links. VBA links are at the bottom of the first post.![]()
ChemistB
My 2¢
Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)
One more thing. I found out if I insert a new Column, the formula is not in effect since it is pointing to H
is there a way to make dynamic ?
Oceans Blue
Create a range name for H12:H100 (select the cells, then type a range name into the name box in the upper left corner, left of the formula bar), for example MyRange. Then change the code to
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("MyRange")) Is Nothing Then Exit Sub If Target = "P" Then Target.Offset(0, 3).Value = Now() If Target = "F" Then Target.Offset(0, 3).Value = "Fail" End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks