+ Reply to Thread
Results 1 to 5 of 5

How to stop infinite loop in VBA Excel in Heat pump simulation?

  1. #1
    Registered User
    Join Date
    09-02-2019
    Location
    Saga, Japan
    MS-Off Ver
    2016
    Posts
    2

    Post How to stop infinite loop in VBA Excel in Heat pump simulation?

    Dear all,

    Currently, I do vapor compression heat pump cycle simulation in Visual Basic for Application. The thermo-physical properties of fluids are taken from Refprop. The program keep on looping in outlet condenser side. Especially on "DoEvent" script. In the iteration, I see the iteration value of parameters has some correct value. So I try to stop the loop on that value by changing "DoEvent" to "Exit Do" script but the Excel is not responding.

    I am sorry I do not post the code. Actually, the script is too long and I am confused which part I can share.

    Do you have any solution?

    Thank you for your help

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How to stop infinite loop in VBA Excel in Heat pump simulation?

    Hi welcome to the forum.
    I would suggest you include an on error event to trap the Esc key being pressed.
    If Esc is pressed then the loop can be interrupted.
    I've got some code somewhere, I'll look for it.
    But you can Google for it.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How to stop infinite loop in VBA Excel in Heat pump simulation?

    Found the code:


    Please Login or Register  to view this content.
    This is the idea

  4. #4
    Registered User
    Join Date
    09-02-2019
    Location
    Saga, Japan
    MS-Off Ver
    2016
    Posts
    2

    Post Re: How to stop infinite loop in VBA Excel in Heat pump simulation?

    Dear Keebellah

    Thank you for your help. I will try your suggestion. I will ask if i find problems.

    Thank you so much

    Teguh

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: How to stop infinite loop in VBA Excel in Heat pump simulation?

    If you're 'handy' with VBA it's a cinch
    else ... just ask, In the meantime I'll put together a sample code where you can see how it works

+ 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. [SOLVED] Email a range of excel cells using VBA produces infinite loop HELP
    By kjam in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-13-2015, 09:58 PM
  2. VBA code to stop Infinite loop
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-20-2015, 05:33 PM
  3. [SOLVED] VBA Worksheet Tab Rename Macro Causing Excel Infinite Loop
    By rbrookov in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-07-2014, 08:10 PM
  4. [SOLVED] Excel Crash During (Shouldn't be infinite) While Loop
    By publius190 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2014, 12:21 PM
  5. Replies: 0
    Last Post: 10-04-2012, 10:06 AM
  6. [SOLVED] VBA infinite loop
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2012, 12:20 PM
  7. Excel 2007 - Print Macro - Infinite Loop Issue
    By Fraenk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2012, 07:50 AM

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