+ Reply to Thread
Results 1 to 5 of 5

How to update a function when opening worksheet

  1. #1
    bugmenot
    Guest

    How to update a function when opening worksheet

    I made


    Please Login or Register  to view this content.
    and then in a cell I entered =GetMonth()
    and it displays what I want it to display but does not update when I reopen the program in the even that the date has changed... How would I go about doing this? I don't mind making a button to refresh the data as I already have one that does that and I could just add to it
    Last edited by bugmenot; 07-21-2009 at 01:45 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to update a function when opening worksheet

    Hello bugmenot,

    Make your Function Volatile. This will force it to update when the worksheet recalculates.

    Volatile Method
    Marks a user-defined function as volatile. A volatile function must be recalculated whenever calculation occurs in any cells on the worksheet. A nonvolatile function is recalculated only when the input variables change. This method has no effect if it's not inside a user-defined function used to calculate a worksheet cell.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    bugmenot
    Guest

    Re: How to update a function when opening worksheet

    Hmm, I have done that and when I go to reopen the workbook it has not changed.

    The reason I am doing this (there might be a better way) is that I need the number of the month that corresponds to the current month.

    In H2 I have =NOW() formatted as m
    I then need to convert that to strictly a number, hense the function I created. I just can't get it to automatically update when I reopen the worksheet. (H2 automatically updates)

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to update a function when opening worksheet

    Hello bugmenot,

    You don't need to retrieve the cell value to return the month. You can do this way...
    Please Login or Register  to view this content.
    In cell "H2" use this formula...
    Please Login or Register  to view this content.

  5. #5
    bugmenot
    Guest

    Re: How to update a function when opening worksheet

    Works! Thank you so much for your help. I really do appreciate it. You guys are very kind offering your help like this.

+ 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