+ Reply to Thread
Results 1 to 4 of 4

Improve efficiency of code

  1. #1
    Registered User
    Join Date
    01-28-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Improve efficiency of code

    I have 4 macros, running one after the other. The main worksheet, Data, contains ~100K lines. Each of the 4 macros filters Data by a string, copies and pastes the results of the filter into another worksheet, then releases the filter on Data. The macros do work as expected, but take ~hour to complete. I'd greatly appreciate any help to speed these macros up.

    Here's one of the macros; all are similiar, just work on different strings and paste into a different worksheet -

    Please Login or Register  to view this content.
    Last edited by blinks; 04-08-2011 at 02:57 PM. Reason: Clarify title at moderator's request

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

    Re: Code takes forever

    Difficult to comment without a sample of the data to test a solution.

    In simple terms, avoid selecting sheets and cells.

    It would look something like:

    Please Login or Register  to view this content.

    I'm a bit concerened about the delete part as, as it stands, it will probably delete the header row too..


    Please upload a sample workbook with some typical data and selection criteria if you want to explore this further.

    Regards
    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
    Registered User
    Join Date
    01-28-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Code takes forever

    Thanks TMShucks, have uploaded a sample workbook.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-28-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Improve efficiency of code

    The problem with the code seems to be that this line -

    Code:
    Please Login or Register  to view this content.
    copies not just the rows with data, but *all* of the million empty lines as well.

    How can I restrain the above code to just those lines with data?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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