+ Reply to Thread
Results 1 to 5 of 5

how to update all functions on an Excel worksheet

  1. #1
    Registered User
    Join Date
    08-12-2007
    Posts
    6

    how to update all functions on an Excel worksheet

    Hello Everybody

    I have created some functions in Visual Basic in my Worksheet, and I have many cells whose value is generated using that function. Every time I make changes in the "source" data I have to update the calculation on each cell where the function is involved. I step on the cell, press "F2" and "Enter", the same thing for every cell.
    Is there a short way to update all the functions at once in a worksheet?

    Regards

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Have you got calculation set to manual? Tools > Options > Calculation.

    Or press F9 to force calculation.

  3. #3
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    Try to add this line to in the start of your VBA code in the function:

    Application.Voilatile

    This makes the function recalculate when Excel recalculates.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    If your function takes as arguments the variables it needs (as opposed to it wandering through the sheet to find them, which is terrible practice) then Excel knows (via a dependency tree) when it needs to be recalculated, and will do so automatically if calculation is set to Automatic as StephenR suggested.

    The need for Application.Volatile is rare, and overuse in complex functions will make your spreadsheet act like it just finished a big lunch and three beers.

  5. #5
    Registered User
    Join Date
    08-12-2007
    Posts
    6
    I have checked Tools > Options > Calculation to "Manual" (Previously it was in "Automatic"), and I have included the command "Application.Volatile" in the VBA code. Then all the cells update when pressing F9. But if I only do one of both things (Calculation to "Manual" or Application.Volatile) it does not update.
    Anyway, I am happy to have my query solved. Thank you very much for your help.

    Regards

+ 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