+ Reply to Thread
Results 1 to 6 of 6

Macro taking too long to finish

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2021
    Posts
    50

    Macro taking too long to finish

    I have the macro below which works as intended... except... it takes 15-20 minutes to go through 2000 lines.

    Any suggestions on how to speed it up, perhaps by writing the macro differently? Any help is appreciated!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro taking too long to finish

    Hi

    When deleting rows, it is better to start at the bottom and work up.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,602

    Re: Macro taking too long to finish

    Try this one:
    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro taking too long to finish

    Hi DKabi,

    Your's is running off the end because rownum never gets to 2000!


    This is called "block deletions":

    Please Login or Register  to view this content.
    Last edited by xladept; 04-16-2013 at 07:48 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    11-15-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2021
    Posts
    50

    Re: Macro taking too long to finish

    Thanks everyone for your suggestions. I decided to go with Rylo's code, as it appeared to be quickest to execute.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro taking too long to finish

    Hi DkAbi,

    I believe that Ben's code is by far the quickest

+ 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