+ Reply to Thread
Results 1 to 6 of 6

Testing output of one Function with another

  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    116

    Testing output of one Function with another

    Afternoon

    I would like a little help regarding using output of one UDF with another. Second query is there a "Do Nothing" response in VBA so where if the result of test is true it does nothing.

    I will probably need to upload this workbook when I go home. But if anyone can spot a few newbie errors in my code I will update them so I can upload the best workbook possible.

    This is my code
    Please Login or Register  to view this content.
    Basic goals are too insert date ddmmyyyy in a cell on workbook first open.
    Then test if one of two merged cells contains text and keep testing until it does and then insert time in cell.
    Third try to ensure date does not update when file reopened unless user manually writes date or time.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Testing output of one Function with another

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-16-2009
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    116

    Re: Testing output of one Function with another

    I have attached worksheet. Still can't get the call one function output from another.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Testing output of one Function with another

    Hi flebber;
    I don't work in XL2007, so if my observations don't make sense, just ignore them.
    1) LastSaved will ALWAYS be before Now. There is no way in the world that the file was saved at some time in the future.
    I'm guessing that you want to check LastSaved against the value stored in D4.
    Also, LastSaved should return a Date not a string.
    Please Login or Register  to view this content.
    2) The following code will "Do Nothing" if some test is true
    Please Login or Register  to view this content.
    or usually more effieciently
    Please Login or Register  to view this content.
    3) What is this line supposed to do?
    Please Login or Register  to view this content.
    I'm guessing that you want to put Now into D4. If so then:
    Please Login or Register  to view this content.
    4) If you want DateTime() to work on Workbook_Open you need this sub in ThisWorkbook module
    And put DateTime into a Standard Module and don't make it Private (otherwise Workbook_Open() won't find it).
    Please Login or Register  to view this content.
    5)
    I'm guessing that when you say:
    Then test if one of two merged cells contains text and keep testing until it does and then insert time in cell.
    you mean that when the file opens to keep testing the cell until it changes.
    If that is right, there is a MUCH more efficient way to do it.
    Assuming that the cell to test is G3, put this in Sheet 1 module
    Please Login or Register  to view this content.
    6) Don't know what you mean by this line.
    Third try to ensure date does not update when file reopened unless user manually writes date or time.
    The file will always be reopened whenever the file is opened (except when it's first being created).
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  5. #5
    Forum Contributor
    Join Date
    07-16-2009
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    116

    Re: Testing output of one Function with another

    Awesome . I realise I was in the case of lastsaved trying to create a UDF but didn't fully understand as I am new to vba programming.

    Regarding point 6 all I meant to say was that I didn't want the date to update everytime the workbook opens after the intial save I will be creating a function to save file as "some_username_Month_Year". If a user opened this file I don't want the scorecard reference date to change again to new date.

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Testing output of one Function with another

    Quote Originally Posted by flebber View Post
    Regarding point 6 all I meant to say was that I didn't want the date to update everytime the workbook opens after the intial save I will be creating a function to save file as "some_username_Month_Year". If a user opened this file I don't want the scorecard reference date to change again to new date.
    I can't follow your logic. It would probably help, if you explained it in words. Like this.

    I have a master file that I don't want altered.
    When a user opens the master file and changes anything, I want the master file to automatically save the changes into a new file with a name that is constructed using the user's name and the current month & year, and never re-save itself.
    The ONLY time I want the master file to allow itself to be re-saved is if the user manually entered a date into a specific cell.

    Or something similar.

+ 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