+ Reply to Thread
Results 1 to 8 of 8

Permanent date stamp based on IF statement outcome

  1. #1
    Registered User
    Join Date
    01-15-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Permanent date stamp based on IF statement outcome

    Hello

    I am struggling to get the following code to work as I use an IF statement to generate the desired reponsed

    the if statement is

    Please Login or Register  to view this content.
    the VBA coding i found is as follows but limited knowledge of amending VBAs has left me stuck. Can you help

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Permanent date stamp based on IF statement outcome

    Right click on sheet tab and paste changed version of above code:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    01-15-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Permanent date stamp based on IF statement outcome

    Works a treat many thanks Kaper

  4. #4
    Registered User
    Join Date
    06-25-2013
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Permanent date stamp based on IF statement outcome

    Are you sure you want to populate your cells with spaces " "? I don't see any advantage in doing that. Personally, I would change " " to "" (null or nothing.)

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Permanent date stamp based on IF statement outcome

    Probably in "real life" still something different, and also not 1 but as title suggests: "Permanent date stamp".
    Anyway - as the backbone is arranged properly, specific actions can be easily changed.

  6. #6
    Registered User
    Join Date
    06-25-2013
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Permanent date stamp based on IF statement outcome

    Yeah, I tend to see only the code in front of me and forget what the title of the thread is. Given that, I know he wouldn't want to use the now() function as that is volatile, but since he is using VBA code, maybe:
    format(Now,"mm-dd-yy")

  7. #7
    Registered User
    Join Date
    01-15-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Permanent date stamp based on IF statement outcome

    I did change it to "" and used the DATE function instead of a 1.

    The only issue I am finding now is that it does not calculate when the criteria is met. I have to manually run the IF statement to get the DATE to appear

  8. #8
    Registered User
    Join Date
    06-25-2013
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Permanent date stamp based on IF statement outcome

    Hmm, it worked for me. I made the changes to Kaper's code as discussed:

    Please Login or Register  to view this content.
    I don't work with events, but to test it, I went into the Worksheet, in my case, I used Sheet3. I double clicked on sheet3 in the project pane, chose worksheet from the dropdown menu, and located the change event, and pasted code. I didn't need to do that last step, and if I hadn't, I would not have had to then delete the now redundant first and last lines. But as I say, I don't work with events, so I wante3 to make doubly sure I was putting the code in the right place.

    I then made some changes to a cell in the range of a1:a100 and either today's date appeared (if value was over 300 or if less then 300, data was erased.


    A
    B
    1
    Num
    Date?
    2
    307
    5/9/2014
    3
    7
    4
    300
    5
    356
    5/9/2014
    6
    b
    7
    777
    5/9/2014
    8
    66


    Okay, I actually made a couple other small changes. 1, changed range to start from A2 so I could use a header in A1:B1, and, I noticed when I used a letter, "b", it put in date. I don't know if b is > 300, but I added an Isnumeric test:

    Please Login or Register  to view this content.
    By the way, I got curious as to whether that was a valid way of putting a date in a cell. It appears it is via Immediate Pane:
    ? isdate(cells(5,2))
    True

    Sorry, I missed the 1st step that Kaper posted:
    Right click on sheet tab and paste changed version of above code:

    That's much easier than what I described. And I learned something new.
    Last edited by klvaughnsd; 05-09-2014 at 04:57 PM. Reason: Left out a step

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Insert permanent Date & Time stamp if & when another cell is populated
    By valentino1989 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2014, 10:15 AM
  2. [SOLVED] Insert permanent Date & Time stamp if & when another cell is populated
    By David_S_Walker in forum Excel General
    Replies: 6
    Last Post: 03-12-2014, 06:08 AM
  3. Date Stamp based on cell value
    By RedWrangler in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-05-2012, 12:09 PM
  4. [SOLVED] Insert permanent Date & Time stamp if & when another cell is populated
    By BASELOO in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-18-2012, 02:27 PM
  5. Compare Dates To Date Range & Return Date Based On Outcome
    By gusmontoya in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-03-2008, 09:06 PM

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