+ Reply to Thread
Results 1 to 7 of 7

How to Refresh VB Functions Automatically in Excel?

Hybrid View

  1. #1
    Phillip Nolan
    Guest

    How to Refresh VB Functions Automatically in Excel?

    I can define a Visual Basic function (via Tools -> Macro -> Visual
    Basic Editor) and the function is indeed called for all cells
    referencing it the first time that I select "Close and Return to
    Microsoft Excel."

    The problem is that when I re-edit the same function and "Close and
    Return to Microsoft Excel" the cells are not updated automatically.

    How can I get Excel to refresh my entire page automatically upon saving
    my VB function and returning to Excel?


  2. #2
    Jim Thomlinson
    Guest

    RE: How to Refresh VB Functions Automatically in Excel?

    Add Application.Volitile at the beginning of the function. Doing this will
    force the cells to recalculate every time that the sheet recalculates. Add
    this line. Go back to the sheet and hit F9 to recalculate. If
    application.volitile is not required as a regular part of the function then
    comment it out when you are finished modifying.
    --
    HTH...

    Jim Thomlinson


    "Phillip Nolan" wrote:

    > I can define a Visual Basic function (via Tools -> Macro -> Visual
    > Basic Editor) and the function is indeed called for all cells
    > referencing it the first time that I select "Close and Return to
    > Microsoft Excel."
    >
    > The problem is that when I re-edit the same function and "Close and
    > Return to Microsoft Excel" the cells are not updated automatically.
    >
    > How can I get Excel to refresh my entire page automatically upon saving
    > my VB function and returning to Excel?
    >
    >


  3. #3
    Niek Otten
    Guest

    Re: How to Refresh VB Functions Automatically in Excel?

    This may work, but there is no guarantee that it will calculate the cells in
    the correct order. Also they will be recalculated no matter if that's
    necessary or not, which may or may not be a problem from a performance point
    of view.
    The only correct way is to include all input to the function in the argument
    list, just like in "real" math. That's the concept of functions. Never
    access precedent cells (or even others) directly from within your functions.

    Kind regards,

    Niek Otten

    "Phillip Nolan" <[email protected]> wrote in message
    news:[email protected]...
    >I can define a Visual Basic function (via Tools -> Macro -> Visual
    > Basic Editor) and the function is indeed called for all cells
    > referencing it the first time that I select "Close and Return to
    > Microsoft Excel."
    >
    > The problem is that when I re-edit the same function and "Close and
    > Return to Microsoft Excel" the cells are not updated automatically.
    >
    > How can I get Excel to refresh my entire page automatically upon saving
    > my VB function and returning to Excel?
    >




  4. #4
    Niek Otten
    Guest

    Re: How to Refresh VB Functions Automatically in Excel?

    <This may work>

    was meant to be a reply to Jim's answer

    "Niek Otten" <[email protected]> wrote in message
    news:O0DkKNq%[email protected]...
    > This may work, but there is no guarantee that it will calculate the cells
    > in
    > the correct order. Also they will be recalculated no matter if that's
    > necessary or not, which may or may not be a problem from a performance
    > point of view.
    > The only correct way is to include all input to the function in the
    > argument list, just like in "real" math. That's the concept of functions.
    > Never access precedent cells (or even others) directly from within your
    > functions.
    >
    > Kind regards,
    >
    > Niek Otten
    >
    > "Phillip Nolan" <[email protected]> wrote in message
    > news:[email protected]...
    >>I can define a Visual Basic function (via Tools -> Macro -> Visual
    >> Basic Editor) and the function is indeed called for all cells
    >> referencing it the first time that I select "Close and Return to
    >> Microsoft Excel."
    >>
    >> The problem is that when I re-edit the same function and "Close and
    >> Return to Microsoft Excel" the cells are not updated automatically.
    >>
    >> How can I get Excel to refresh my entire page automatically upon saving
    >> my VB function and returning to Excel?
    >>

    >
    >




  5. #5
    Tushar Mehta
    Guest

    Re: How to Refresh VB Functions Automatically in Excel?


    Just use CTRL+SHIFT+ALT+F9 which is the keyboard shortcut for "Force
    recalculate everything in sight and then some more." {grin}

    No need for something as volatile as Application.Volatile.

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <[email protected]>,
    [email protected] says...
    > I can define a Visual Basic function (via Tools -> Macro -> Visual
    > Basic Editor) and the function is indeed called for all cells
    > referencing it the first time that I select "Close and Return to
    > Microsoft Excel."
    >
    > The problem is that when I re-edit the same function and "Close and
    > Return to Microsoft Excel" the cells are not updated automatically.
    >
    > How can I get Excel to refresh my entire page automatically upon saving
    > my VB function and returning to Excel?
    >
    >


  6. #6
    Niek Otten
    Guest

    Re: How to Refresh VB Functions Automatically in Excel?

    Hi Tushar,

    Even then, if (some of) the input cells weren't in the argument list, there
    is no guarantee that the formulas will be calculated in the correct order
    and will remain to do so in future versions of Excel; this is not part of
    Excel's specifications.

    --
    Kind regards,

    Niek Otten

    "Tushar Mehta" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Just use CTRL+SHIFT+ALT+F9 which is the keyboard shortcut for "Force
    > recalculate everything in sight and then some more." {grin}
    >
    > No need for something as volatile as Application.Volatile.
    >
    > --
    > Regards,
    >
    > Tushar Mehta
    > www.tushar-mehta.com
    > Excel, PowerPoint, and VBA add-ins, tutorials
    > Custom MS Office productivity solutions
    >
    > In article <[email protected]>,
    > [email protected] says...
    >> I can define a Visual Basic function (via Tools -> Macro -> Visual
    >> Basic Editor) and the function is indeed called for all cells
    >> referencing it the first time that I select "Close and Return to
    >> Microsoft Excel."
    >>
    >> The problem is that when I re-edit the same function and "Close and
    >> Return to Microsoft Excel" the cells are not updated automatically.
    >>
    >> How can I get Excel to refresh my entire page automatically upon saving
    >> my VB function and returning to Excel?
    >>
    >>




  7. #7
    Tushar Mehta
    Guest

    Re: How to Refresh VB Functions Automatically in Excel?

    Hi Niek,

    In article <OooG#iq#[email protected]>, [email protected]
    says...
    > Hi Tushar,
    >
    > Even then, if (some of) the input cells weren't in the argument list, there
    > is no guarantee that the formulas will be calculated in the correct order
    > and will remain to do so in future versions of Excel; this is not part of
    > Excel's specifications.
    >
    >

    If the function uses information that XL doesn't know about it's just
    bad design and using App.Volatile is a band-aid. Far better to design
    the UDF so that cells used in it are passed as arguments.

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

+ 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