+ Reply to Thread
Results 1 to 7 of 7

Excel bug? VBA Application.Calculate not actually working

  1. #1
    Registered User
    Join Date
    08-19-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    9

    Excel bug? VBA Application.Calculate not actually working

    I have searched pretty hard for an answer, so hopefully this isn't a duplicate post.

    I have a fairly calculation intensive model. The VBA isn't doing anything crazy, it just loops through 20,000 iterations by changing 2 values. The code is then copying the results to another sheet for each iteration (a 76x4 matrix).
    My loop basically is as follows:

    Turn off screen updating & go to manual calculations
    loop start
    Change value 1
    Change value 2
    application.calculate
    copy values
    next

    Now here is the odd part...The application.calculate is not actually running randomly for many of the iterations. Therefore I'll have several result matrices with the same values, and then it will all the sudden kick back into calculation. The results matrices should never be the same. The ones which aren't calculating changes each time. I even tried doing application.calculateFull, but this doesn't work either. You can not replicate the problem when debugging. It's almost like excel is copying the results before the calculate finishes.

    Please help!! I've tried so many things.
    Thanks!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Excel bug? VBA Application.Calculate not actually working

    Are using this to turn calculations back to automatic...
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    08-19-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel bug? VBA Application.Calculate not actually working

    I mean yes, I do, but that shouldn't even have an impact on the values its copying during the loop.

  4. #4
    Registered User
    Join Date
    08-19-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel bug? VBA Application.Calculate not actually working

    I'm guessing this could even be an issue with limited hardware resources.

  5. #5
    Registered User
    Join Date
    08-19-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Excel bug? VBA Application.Calculate not actually working

    Still looking for help if possible.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,460

    Re: Excel bug? VBA Application.Calculate not actually working

    I have not heard of anything like this, nor have I been able to recreate the problem on my own. We will probably not be able to help much without a sample spreadsheet that demonstrates the problem. Recognizing that it seems to be inconsistent on your end, it may be difficult to provide. If you can put together a sample spreadsheet that randomly behaves this way, then we will have something to look at and see if we can help debug this.

    For debugging on your own, perhaps something like this will help.
    Please Login or Register  to view this content.
    As noted, these additions will cuase VBA to go into debug mode whenever resultafter is not different from resultbefore. From debug mode, you can inspect variables and values in the spreadsheet and see if you can better see what is happening right at the point when the problem occurs.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    03-29-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Excel bug? VBA Application.Calculate not actually working

    I'm having the same problem. I have a small macro that opens an excel file, runs a data table, then copies values to another file. However, it does not allow enough time for the data table to calculate. I tried inserting the following:

    Please Login or Register  to view this content.
    Application.Wait(Now + TimeValue("00:03:00"))
    Please Login or Register  to view this content.
    yet it still doesn't calculate the data table.

    any suggestions welcomed.

+ 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. Application.ExecuteExcel4Macro not working in Excel 2013
    By karenmwhaley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2016, 08:11 PM
  2. Excel 2013 Application.Statusbar not working
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2015, 09:25 AM
  3. English Excel-VBA application not working in Germany
    By florin_excel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-23-2013, 06:35 AM
  4. [SOLVED] program working in the code application, but not the excel sheet
    By emilyloz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2013, 09:20 AM
  5. Replies: 0
    Last Post: 08-27-2012, 03:03 AM
  6. application.filesearch not working in excel 2007
    By johnjohns in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-21-2009, 05:22 AM
  7. Excel for Mac, Application.FileSearch not working
    By Richard Buttrey in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-04-2009, 10:25 AM

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