+ Reply to Thread
Results 1 to 4 of 4

Code works fine when stepping through code but Excel freezes if I run it without stepping

  1. #1
    Forum Contributor
    Join Date
    05-30-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2013
    Posts
    107

    Code works fine when stepping through code but Excel freezes if I run it without stepping

    The following macro Main_FinExport runs fine when I start the procedure of with Stop and then step through the code with Shift+F8. But when I just run it, Excel crashes every time. Any ideas for how I can fix this?

    Please Login or Register  to view this content.
    Last edited by OldManExcellor; 01-15-2016 at 09:11 AM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Code works fine when stepping through code but Excel freezes if I run it without stepp

    Hi OldManExcellor,

    Your symptoms sound like a problem caused by an endless loop that occurs when Excel Events are NOT disabled. That is probably why the code works when you Single Step.

    Try:
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Contributor
    Join Date
    05-30-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2013
    Posts
    107

    Re: Code works fine when stepping through code but Excel freezes if I run it without stepp

    To the best of my knowledge I have no macro in the file that triggers on event change. But your solution seems to work. The macro hasn't caused Excel to freeze all day. I had a lot of headache because of this. Thank you a lot Lewis!

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Code works fine when stepping through code but Excel freezes if I run it without stepp

    To the best of my knowledge I have no macro in the file that triggers on event change.
    Your welcome. It does not have to be a macro. If you have formulas that change, you could be triggering a Worksheet_Calculate() event each time a formula is affected, which may cascade and cause a lot of calculations.

+ 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. Stepping through code produces different result than running code
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2015, 08:27 AM
  2. Replies: 1
    Last Post: 03-31-2015, 03:01 PM
  3. [SOLVED] Excel-to-eMail Code Works Only When Stepping Through
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2014, 11:19 PM
  4. VBA code behaves differently while stepping?
    By mhni in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2009, 09:01 AM
  5. Stepping through Code
    By ben in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-08-2006, 05:50 PM
  6. How to get value of variable when single stepping through code?
    By Chet Shannon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2005, 05:55 PM
  7. Code works when stepping through, but cuts out when run
    By Reenen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2005, 07:47 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