+ Reply to Thread
Results 1 to 3 of 3

Unexplained Macro Lag between different Spreadsheets(Reports) for same code

  1. #1
    Registered User
    Join Date
    04-13-2016
    Location
    Iowa, USA
    MS-Off Ver
    2010
    Posts
    18

    Unexplained Macro Lag between different Spreadsheets(Reports) for same code

    I have a couple sets of virtually the same macro to send blast emails from a report created by an ERP system.

    There are 4 different ERP systems utilized to create 4 different reports with the same general information. Some have more detail than others as well as different styles of formatting.

    The first 2 ran smoothly, averaging about 3 seconds per email. Each report had about 4000 lines of invoice data that were sent through 750-800 emails. Each file was about 4500 KB in size.

    But, when I got to the third ERP system, my below code took forever to run through the initial formatting section, and would then send an email about once a minute. This ERP Report had over 10,000 lines of invoice data. This report had more formatting than the previous two as well as some additional columns of information to be removed. The file size was about 9-10,000 KB in size.

    When I exit the macro after a few minutes of it running slowly, the code in Bold/Red below is commonly where the debugger will cause problems. (I've also attached a sample of the workbook I'm using and replaced any sensitive information with Generic info or symbols to signify their input values)

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.
    I got around this by inserting a new worksheet on the same workbook, copy/pasting about half of the report into the new sheet and then running the code, then once completed I'd copy in the other half and run the macro again. I didn't change/add/remove any formatting and it ran just as quick as the prior two reports had.

    http://www.excelforum.com/attachment...1&d=1464129274

    Does anyone have any ideas on what could be causing this?
    Last edited by SamHink123; 05-24-2016 at 06:49 PM.

  2. #2
    Registered User
    Join Date
    04-13-2016
    Location
    Iowa, USA
    MS-Off Ver
    2010
    Posts
    18

    Re: Unexplained Macro Lag between different Spreadsheets(Reports) for same code

    If I remove formatting, do you think this would solve my issue?

  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
    44,411

    Re: Unexplained Macro Lag between different Spreadsheets(Reports) for same code

    Possibly; you're putting borders round millions of cells. Do you really have 10,000 rows of invoicing data? Maybe use Ctrl-End to see where Excel thinks the last row of data is. If it's way further down than the actual data, that's more likely your problem. 10 Mb is quite a big file and likely to be sluggish. When you copy half the data, twice, and it performs ok, that's indicative that you're leaving something behind. You might find that you can copy ALL the data and it performs ok.
    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


+ 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] Unexplained Slowness
    By shawnvw in forum Excel General
    Replies: 6
    Last Post: 10-09-2015, 08:24 PM
  2. Deleted
    By la_chua29 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2015, 12:55 PM
  3. Macro to generate reports for questionnaire (separate reports for every form)
    By skyvik24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2013, 05:25 AM
  4. Macro to copy comments from reports of one folder to reports of another folder
    By abdulgafoor2007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2013, 09:51 AM
  5. Smart Code Unexplained
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2013, 11:45 AM
  6. Running BO 5.1.8 Reports VIA VBA Code
    By elmarko123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2010, 06:54 AM
  7. Printing Reports From Spreadsheets
    By pegasus host in forum Excel General
    Replies: 2
    Last Post: 12-24-2006, 06:05 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