+ Reply to Thread
Results 1 to 8 of 8

Excel crashes with "heavy" macros

  1. #1
    Registered User
    Join Date
    12-25-2015
    Location
    GREECE
    MS-Off Ver
    2007
    Posts
    31

    Lightbulb Excel crashes with "heavy" macros

    Ok I don't know if my macros are heavy, plus I don't know if I my macros are even correct written, they are working but...
    I've created an excel that has many macros to open, copy, paste with format, save, open close etc.
    I believe some of them are large or heavy and sometimes, not always, excel stops working, I get the error of excel saying if I want to restart or find a solution in the internet.
    This is one macro that crashes the excel sometimes.
    Any ideas?

    Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by alkiviadi; 10-26-2016 at 11:10 AM. Reason: Didn't know about [code], sorry.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Excel crashes with "heavy" macros

    (code tags added, thanks)
    Last edited by Olly; 11-01-2016 at 06:59 AM.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: Excel crashes with "heavy" macros

    Not sure what you mean by 'heavy' macros but Excel can handle any length of macro that reasonably can be written. Normally only when you get into Recursive macros that you risk "out of stack" space or some other error. I did notice that your code did not Dimension wb1 and 2 as worksheets.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel crashes with "heavy" macros

    The first thing you should do is get rid of all the select/activate stuff, it's just not needed and can cause problems.

    For example the first few lines of the code you posted can be rewritten like this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    11-19-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    2016
    Posts
    57

    Re: Excel crashes with "heavy" macros

    Get rid of 'Copy' altogether. Instead use 'destinationRange.Value = sourceRange.Value'
    This uses much less memory and can greately speed up the code. Especially when you are moving large amounts of data.

    Try this:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-25-2015
    Location
    GREECE
    MS-Off Ver
    2007
    Posts
    31

    Re: Excel crashes with "heavy" macros

    First of all i want to thank everyone for replying. Im going to try what you suggest and get back to you.

  7. #7
    Registered User
    Join Date
    12-25-2015
    Location
    GREECE
    MS-Off Ver
    2007
    Posts
    31
    I kmow excel can do magic its my macros that i dont know if they are reasonably written. Anyway workbook 1 & 2 are not sheets they are different workbooks. They are both open and i take stuff from one workbook to another.

    Quote Originally Posted by EssoExplJoe View Post
    Not sure what you mean by 'heavy' macros but Excel can handle any length of macro that reasonably can be written. Normally only when you get into Recursive macros that you risk "out of stack" space or some other error. I did notice that your code did not Dimension wb1 and 2 as worksheets.

  8. #8
    Registered User
    Join Date
    12-25-2015
    Location
    GREECE
    MS-Off Ver
    2007
    Posts
    31

    Re: Excel crashes with "heavy" macros

    This worked perfectly. Thank you.
    In the end of the macro though I used one copy/paste for:
    Else "to copy the range and paste it to the first empty cell of the other sheet."
    But that "value thing" works very quickly, thanks again.

+ 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] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. Excel crashes when running a "delete" macro
    By dmarx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2015, 03:28 AM
  3. [SOLVED] Excel Crashes or Gives "Automation Error" on Mac when running Macro
    By mlj61289 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 04:39 PM
  4. compare two excel sheets using macros and display the result in "true" or "false"
    By gayunana01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2012, 07:21 AM
  5. Replies: 1
    Last Post: 06-13-2012, 10:14 AM
  6. "Heavy" Parse Txt File to Excel
    By MBCMDR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2009, 12:58 AM
  7. Replies: 0
    Last Post: 09-11-2008, 02:03 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