+ Reply to Thread
Results 1 to 8 of 8

Thread: NOW () formula that won't change next day !

  1. #1
    Registered User
    Join Date
    02-09-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    78

    NOW () formula that won't change next day !

    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?
    Attached Images Attached Images
    Oceans Blue

  2. #2
    Registered User
    Join Date
    10-31-2011
    Location
    New York City, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: NOW () formula that won't change next day !

    I believe the NOW function is always volatile, but you could perhaps make a macro to copy that column and then paste as values.

  3. #3
    Registered User
    Join Date
    02-09-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: NOW () formula that won't change next day !

    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

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Re: NOW () formula that won't change next day !

    There is no other way. Right click on the sheet tab and choose "View Code". Paste this code into the text box in VBA Editor
    Private 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
    Close VBA Editor

    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)

  5. #5
    Registered User
    Join Date
    02-09-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: NOW () formula that won't change next day !

    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

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Re: NOW () formula that won't change next day !

    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)

  7. #7
    Registered User
    Join Date
    02-09-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    78

    Re: NOW () formula that won't change next day !

    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

  8. #8
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,151

    Re: NOW () formula that won't change next day !

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0