+ Reply to Thread
Results 1 to 2 of 2

Excel For Next Loops and Not Reponding State

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    boston, ma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Thumbs up Excel For Next Loops and Not Reponding State

    Hello,

    I am working for next loops to run through a numerical integration and I am running into a problem with excel not responding. Even through excel is not responding, the macro still completes and posts the correct solution. Excel returns to a functional state near the end of the macro completion. I linked a progress bar to outer loop to see where it is getting hung up. Excel stops responding when the progress bar reaches 16-18%, and then hangs at this % until the macro completes. The calculations are completed accurately and the macro will run to completion. Everything works other than the temporary not responding state.

    There are three for next loops within an outer for next loop.

    Array2(501, 3) As Double
    Array3(501, 5) As Double
    Array4(501, 3) As Double
    Array5(101, 3) As Double

    For i=1 to 101
    For k = 1 to 501
    Array2(k, 1) = Calculation 1
    Array2(k, 2) = Calculation 2
    Array2(k, 3) = Calculation 3
    Next

    For k = 1 to 501
    Array3(k, 1) = Calculation 1
    Array3(k, 2) = Calculation 2
    Array3(k, 3) = Calculation 3
    Array3(k, 4) = Calculation 4
    Array3(k, 5) = Calculation 5
    Next

    For k = 1 to 501
    Array4(k, 1) = Calculation 1
    Array4(k, 2) = Calculation 2
    Array4(k, 3) = Calculation 3
    Next

    Array5(i, 1) = Calculation 1 (based on outputs from previous 3 loops)
    Array5(i, 2) = Calculation 2 (based on outputs from previous 3 loops)
    Array5(i, 3) = Calculation 3 (based on outputs from previous 3 loops)

    Next


    Thanks

  2. #2
    Registered User
    Join Date
    06-27-2012
    Location
    boston, ma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Excel For Next Loops and Not Reponding State

    One more thing.....the calculation steps user a UDF linear interpolation function.....If i remove this step, then the macro completes much faster without getting stuck in the not responding state.

    Is there a better place to integrate this function? Directly into the macro?

+ 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