+ Reply to Thread
Results 1 to 5 of 5

VBA to calculate each formula in worksheet one by one

  1. #1
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    VBA to calculate each formula in worksheet one by one

    Hi,

    I have a workbook that contains large formulas in each cell of a certain range in a worksheet (AC16:SMF988). The formulas refer to other worksheets in the workbook, as well as to the worksheet that the formulas themselves are located in.

    Excel will run out of resources quickly when I am trying to copy these formulas across even a small section of the aforementioned range when using Automatic calculation method. Excel will also run out of resources If I copy the formulas across in Manual calculation method first and then click Calculate sheet. What seems to work though, is that I copy the formulas across in Manual calculation mode and then calculate each formula one by one, by clicking inside the formula bar of the cell containing the formula and pressing enter. This will take an awful lot of time though, if I'm going to run through the range manually.

    I therefore wonder if someone has a VBA code that could run through each cell in the range AC16:SMF988 and calculate the formulas one by one, proceeding to the next one only when calculation of the current formula has been completed, if I have first pasted them across the range in Manual calculation mode?

    Best regards,
    Marbleking
    Last edited by Marbleking; 03-15-2021 at 10:52 AM.

  2. #2
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: VBA to calculate each formula in worksheet one by one

    Hi again,

    I have tried this code and it seems to do what I need, but it is very slow:


    Please Login or Register  to view this content.
    Any tips on how to make it faster?

    Regards,
    Marbleking

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    Hi,

    As a VBA loop works element by element so it may need more time than letting Excel working as usual …

    But at the beginning of the procedure try to desactivate the Calculation property like ScreenUpdating
    and EnableEvents if the worksheet code has some event code, all to see in VBA help.

  4. #4
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: VBA to calculate each formula in worksheet one by one

    Thanks, Marc

    I have updated the code and perhaps it calculates a bit faster now:


    Please Login or Register  to view this content.
    Regards,
    Marbleking

  5. #5
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: VBA to calculate each formula in worksheet one by one

    Hi,

    Does anybody know how to modify the VBA above so that it copies a formula residing in, say cell A1 and then pastes it to the current cell in the selected range, before calculating it and then pasting it as a value - and then again moving on to the next cell in the selected range and repeating the procedure?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run Macro and Calculate Formula ONLY in current Worksheet
    By DebDobson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2017, 02:12 AM
  2. [SOLVED] Worksheet Calculate VBA when Formula Column Changed
    By BVT3030 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-07-2016, 08:38 AM
  3. Date Stamp for value change due to formula. - Worksheet Calculate ?
    By joelj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2014, 01:03 AM
  4. Worksheet Attached - Formula needed to calculate commissions vs date and Emp ID #
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-02-2013, 12:36 AM
  5. Formula to match data calculate a value and insert on another worksheet
    By Sharonits in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-05-2013, 09:31 AM
  6. Replies: 3
    Last Post: 02-27-2008, 08:12 AM
  7. [SOLVED] Formula to retrieve range of dates from a worksheet to calculate d
    By accented in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2006, 05:55 PM

Tags for this Thread

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