+ Reply to Thread
Results 1 to 8 of 8

Macro Causes Excel to Restart

  1. #1
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Question Macro Causes Excel to Restart

    Hi Everyone,

    The following simple code make my excel crash.

    Any help is appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro Causes Excel to Restart

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Incidentally you don't need all those .Select statements, they just slow things down, although it won't be those that cause the workbook to close.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Macro Causes Excel to Restart

    Attached
    When run individually this macro runs well.
    But its part of big file and that file crashed every time when I run this macro.
    Attached Files Attached Files

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro Causes Excel to Restart

    Hi,

    The idea was that you would upload the workbook that was crashing, not one that doesn't.
    We can't test what might be failing otherwise.

    That said your error handler which directs program flow back into the loop is bad programming practice, particularly if you've no idea what error might arise.

    Just a guess but you could have entered a runaway loop from which never finishes and Excel just runs out of memory and gives up.

  5. #5
    Forum Contributor
    Join Date
    06-01-2014
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Microsoft 365
    Posts
    224

    Re: Macro Causes Excel to Restart

    Hi Richard,
    I am sorry, the original file cannot be uploaded as there is confidential information in there.
    The macro was running fine until last week.
    I haven't done any structural changes in the file or in fact no change in macro codes at all.
    Anyhow thank you for your time and feedback.
    I will try to figure out what's going on by breaking the code and run it line by line.

    BR,

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Macro Causes Excel to Restart

    @Richard:
    That said your error handler which directs program flow back into the loop is bad programming practice, particularly if you've no idea what error might arise.
    Am I missing something? What error handling?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro Causes Excel to Restart

    Quote Originally Posted by TMS View Post
    @Richard:
    Am I missing something? What error handling?
    Mea culpa.

    Quite correct. I had another workbook open at the time and clearly looked at the wrong one in the VBE Project window.

    Thanks for the correction.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro Causes Excel to Restart

    Quote Originally Posted by ibuhary View Post
    Hi Richard,
    I am sorry, the original file cannot be uploaded as there is confidential information in there.
    The macro was running fine until last week.
    I haven't done any structural changes in the file or in fact no change in macro codes at all.
    Anyhow thank you for your time and feedback.
    I will try to figure out what's going on by breaking the code and run it line by line.

    BR,
    Just anonymise the data. It doesn't matter how many M. Mouse or D. Duck names you have.

+ 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] Macro Causing Excel to Restart
    By JBaum2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2020, 02:35 PM
  2. [SOLVED] Can I pause a running macro then restart it?
    By Jubb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 12:04 PM
  3. Macro: Help, Need Macro, Change Color, Open File, Restart at date
    By fastfire in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 05:52 PM
  4. issues with shared workbook how to pause macro and restart macro
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2013, 11:01 AM
  5. Stop Macro, Select Cell, Restart Macro
    By tenk283 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2010, 12:48 AM
  6. Using IF to restart macro when cell is a particular value
    By Carlsbergen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2010, 09:29 AM
  7. Stop and restart macro(s) programatically
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-20-2010, 11:44 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