+ Reply to Thread
Results 1 to 10 of 10

Stop now function auto updating when new row added

  1. #1
    Registered User
    Join Date
    10-29-2008
    Location
    Endicott, NY
    Posts
    4

    Stop now function auto updating when new row added

    I have fought with this for 2 days and I am trying to have a worksheet cell update the date and time if the cell it is referencing (B3 see below)

    Here is the formula I am using however it updates every time a new row is added to the worksheet. So the Date/Time stamp on each row is always updated to NOW() everytime.

    =IF(ISNA(B3),"0/0/00 00:00",NOW())

    I would like to have a Date/Time stamp stay as is once that row has been added. Is there anyway to stop the field from updating once the date and time have been set?

    ARGGHHH!!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe this event macro.

    Right click sheet tab > select view code > paste in the below. Change DestCell address to the cell reference you want the date and time to appear

    Please Login or Register  to view this content.
    HTH

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    10-29-2008
    Location
    Endicott, NY
    Posts
    4

    Additional Info

    I should have added, each row of the sheet contains a Date/Time reference and when you enter in the information in the first cell it utilizes that data to do a VLOOKUP in the B column range, the C column range is the Date/Time reference that I want date/time stamped a single time and not changed...

    I believe your solution will only work for a single cell reference. If I am wrong just #)$(% yell back at me to straighten me out. I appreciate your help with this.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You are correct. So you could try

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Registered User
    Join Date
    10-29-2008
    Location
    Endicott, NY
    Posts
    4

    Tried the code but the results were not correct??

    This does the opposite. It initially fills all fields with NOW (date and time) and then when information is added to a row it turns all cells in the C column to "00/00/00 00:00"

    I tried flip flopping the NOW and "00/00/00 00:00" in the code and it in turn changes all rows in the worksheet to the current NOW() when any new information is added to the A column in a row.

    Here is a copy of the four cells across each row with the formulas shown, maybe this will make it easier to understand

    125000000000 =VLOOKUP(A8,upcdb!$A$2:$B$2197,2,FALSE) 39751.7661226852 =IF(ISODD(COUNTIF(A3:A200,A8)),"IN BUILDING","OUTSIDE")
    (blank cell) =VLOOKUP(A9,upcdb!$A$2:$B$2197,2,FALSE) 0/0/00 00:00 =IF(ISODD(COUNTIF(A3:A200,A9)),"IN BUILDING","OUTSIDE")

    Here is what the data looks like

    125000000000 Abell, Dave 10/30/08 6:23 PM IN BUILDING
    (Blank cell) #N/A 0/0/00 00:00 OUTSIDE
    Last edited by mountainfarm; 10-30-2008 at 06:32 PM.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps otherwise post a sample file

    Please Login or Register  to view this content.
    VBA Noob

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The NOW Function is vlatile, ie it will update. You can create a static timestamp using a User Defined Function. Insert a module in the workbook and copy this code
    Please Login or Register  to view this content.
    In any cell test it by typing the formula =StaticDate(). Format the cells to show date & time eg dd/mm/yyyy hh:mm.

    Your formula would be

    =IF(ISNA(B3),"0/0/00 00:00",StaticTime())
    Last edited by royUK; 11-01-2008 at 04:37 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  8. #8
    Registered User
    Join Date
    10-29-2008
    Location
    Endicott, NY
    Posts
    4

    Compile Error

    I get a syntax error when I try to run the code.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Very helpful reply considering you had 2 people replying.

    As I said in my post attach a example file

    VBA Noob

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    See the edited version above

+ 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.6.0 RC 1