+ Reply to Thread
Results 1 to 8 of 8

Running VBA / Excel Crashes / Memory Errors

  1. #1
    Registered User
    Join Date
    08-27-2007
    Location
    Australia
    Posts
    60

    Running VBA / Excel Crashes / Memory Errors

    Hi All,

    I am running the macros in the order shown below.

    These macros effectively;
    • Creates a spreadsheet
    • Adds and downloads data
    • Saves it
    • Repeats the process

    The first couple of times this works fine.

    Than it just crashes with a variety of errors.

    Each sheet that is created is only about 5mb in size.
    The spreadsheet is currently 50mb in size.

    About 60% of memory is used when VBA is running with about 70% of CPU.

    Any ideas?

    Thanks

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by tejay; 08-20-2015 at 05:15 AM.

  2. #2
    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
    45,005

    Re: Running VBA / Excel Crashes / Memory Errors

    I can't answer your question directly but a 50 Mb workbook is not doing anyone any favours.

    You can maybe make the code a lot quicker and more efficient if you avoid selecting the worksheet(s) and range(s). For example:

    Please Login or Register  to view this content.

    Regards, TMS
    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


  3. #3
    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
    45,005

    Re: Running VBA / Excel Crashes / Memory Errors

    And this:

    Please Login or Register  to view this content.

    Regards, TMS

  4. #4
    Registered User
    Join Date
    08-27-2007
    Location
    Australia
    Posts
    60

    Re: Running VBA / Excel Crashes / Memory Errors

    Hi TMS,

    Thanks very much for your input.
    I won't be able to verify if this has solved the problem until tomorrow.

    With the second code;

    Please Login or Register  to view this content.
    This doesn't copy the cells down the range, do you know what I need to change?

    Thanks

  5. #5
    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
    45,005

    Re: Running VBA / Excel Crashes / Memory Errors

    Probably just needs a dot (.) in front of Range("A2")


    Please Login or Register  to view this content.

    Regards, TMS

  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
    45,005

    Re: Running VBA / Excel Crashes / Memory Errors

    Dohhh ... this works:

    Please Login or Register  to view this content.

    Regards, TMS

  7. #7
    Registered User
    Join Date
    08-27-2007
    Location
    Australia
    Posts
    60

    Re: Running VBA / Excel Crashes / Memory Errors

    Hi TMS,

    Thanks, made the changes.

    Whilst the changes certainly made things more efficient, the excel spreadsheet would still crash when the file size got above 35mb or so.

    I have decided to export each sheet as its own workbook and re-jig the sheet for that.

    Somewhat pathetic excel cant handle 35mb + in this day and age, but anyway!

    Thanks for your help

    Tejay

  8. #8
    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
    45,005

    Re: Running VBA / Excel Crashes / Memory Errors

    You're welcome.

    Each sheet that is created is only about 5mb in size.
    The spreadsheet is currently 50mb in size.
    To be fair, if I have a WORKBOOK that is 5mb, I'd think of it as big. I can't help wondering what you are downloading that takes up 5mb. That sounds to me as though you maybe you have a bloated template that you are copying, leading to 10 or more bloated worksheets. But, without being able to see the workbook, that's just a guess.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Excel crashes erratically after running a macro
    By David A Coop in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2014, 11:56 PM
  2. large file uses massive memory - crashes
    By lotsbg in forum Excel General
    Replies: 1
    Last Post: 05-17-2012, 02:17 AM
  3. Excel Crashes when saving after running macro
    By msmithdynamicsgp in forum Excel General
    Replies: 0
    Last Post: 10-24-2011, 12:16 PM
  4. Excel sometimes crashes when running a sub routine
    By Brunstgnegg in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 08-20-2010, 06:55 AM
  5. Excel Crashes when saving after running Userform
    By jjking57 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2007, 12:43 PM
  6. Large Excel files and memory errors
    By EnglishDeath in forum Excel General
    Replies: 2
    Last Post: 09-30-2006, 08:37 AM
  7. Pivot Table Memory Issue - Excel crashes
    By rmsterling in forum Excel General
    Replies: 0
    Last Post: 11-11-2005, 06:10 AM
  8. Excel crashes after running Macro
    By sjl17 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2005, 06:27 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