Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Force Recalculation (2002)

    I know that F9 forces recalcuation and that there are various shift-alt-ctrl-F9 combinations for defining the scope of recalculation. How can I force recalculation within the code of a macro or procedure? I need this in code that is referencing cells whose value is obtained using a formula and I want the value to be up to date. Should the act of simply selecting a cell, within a macro or procedure, force the formula for that cell to run?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to Force Recalculation (2002)

    If calculation is set to Automatic, the value of a cell containing a formula should always be up to date.

    If you don't want to set calculation to automatic, you can use the Calculate method in VBA:

    <code>Application.Calculate</code> recalculates all open workbooks.
    <code>Worksheets("Sheet3").Calculate</code> recalculates the specified worksheet.
    <code>Worksheets("Sheet3").Range("A1:E20").Calcula te</code> recalculates the specified range in the specified worksheet.

  3. #3
    New Lounger
    Join Date
    Oct 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Force Recalculation (2002)

    Thanks for the info. I'll try the Calculate method.

    The cell in question uses the today() function, which I guess is an exception to the "automatic" rule. (I do have calculation set to automatic.)

    Thanks again,

    <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15> Phil

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to Force Recalculation (2002)

    Cells containing functions such as TODAY() and NOW() will automatically be updated whenever any calculation occurs, so you're correct: if no calculation occurs, those cells will not be updated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •