+ Reply to Thread
Results 1 to 9 of 9

Macro running slow

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Macro running slow

    I have the following macro that runs very slow. Is there a way to speed it up? Any help would be great. Thanks.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by rhudgins; 07-14-2010 at 01:58 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro running slow

    Try this instead, it will copy all the rows with "1" in column AE but it will copy them all at once, so it should be almost instantaneous, even on large datasets.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 07-13-2010 at 11:40 PM. Reason: FIXED THE LASTCOL VARIABLE
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Macro running slow

    Hi

    See how this goes.

    Please Login or Register  to view this content.
    rylo

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro running slow

    Please check for the corrected version of the macro above.

  5. #5
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Macro running slow

    Thank you both. I can use either of those macros, they both work perfectly.

    I would like to make one slight modification. Can the macro also copy rows that have "#N/A" in column AE in addition to "1"?

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro running slow

    Here you go:
    Please Login or Register  to view this content.


    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  7. #7
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Macro running slow

    Thanks this works now. I found one error. If there are no "1" or "N/A" in the column then the macro copies every row instead of not copying any.

    Can this be fixed?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro running slow

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

  9. #9
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Macro running slow

    Thanks. Perfect.

+ 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