+ Reply to Thread
Results 1 to 12 of 12

Need Help Speeding up my Macro.

  1. #1
    Registered User
    Join Date
    08-06-2016
    Location
    Oklahoma city, Oklahoma, USA
    MS-Off Ver
    2016
    Posts
    30

    Need Help Speeding up my Macro.

    Need some help speeding up my Macro. As of now it takes about 4-8 seconds to complete. I cant seem to figure out why its taking so long, I tried only copying and pasting one column only and still takes a while, Tried screwing around with the cell ranges to a smaller range and still takes a while.

    The Sheet it is filtering and copying data from does have a lot of formulas in it, so maybe that could be why is taking so long? But it shouldnt matter should it, if I turn off auto calculate?

    I have a similar macro for another filter table sheet and it loads almost instantly, only difference is the sheet its copying data from does not have so many formulas.

    I read up that having your code make a bunch of trips to another worksheet to copy data from can slow it down, but I even tried the below macro with just making one trip to copy data and still took awhile to load.

    Please Login or Register  to view this content.
    Thanks,
    Brent

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Need Help Speeding up my Macro.

    I'm not sure if this has anything to do with it, but, I've never seen anyone use Optimize code like you have. My thinking is that doing it this way might be slowing it down a bit because when the main macro runs, it has to wait to run the optimize begin code, then it can continue, then before it can truly "end", it has to wait for the optimize end code to run.
    Try replacing
    Please Login or Register  to view this content.
    With
    Please Login or Register  to view this content.
    and the
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    Then remove the Optimize Begin and End codes altogether.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    08-06-2016
    Location
    Oklahoma city, Oklahoma, USA
    MS-Off Ver
    2016
    Posts
    30

    Re: Need Help Speeding up my Macro.

    Thanks gmr4evr1 for the suggestion.

    I just tried it like you explained, but unfortunately it still ran the same amount of time.

  4. #4
    Registered User
    Join Date
    08-06-2016
    Location
    Oklahoma city, Oklahoma, USA
    MS-Off Ver
    2016
    Posts
    30

    Re: Need Help Speeding up my Macro.

    Here is my excel file, probably should had uploaded this before.

    It is too big to upload directly to this site so the below link will get you the file

    https://www.dropbox.com/s/ww0hj7admb...acro.xlsm?dl=0

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Need Help Speeding up my Macro.

    Why not just attach your file in the post?
    Attached Files Attached Files
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

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

    Re: Need Help Speeding up my Macro.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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


  7. #7
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Need Help Speeding up my Macro.

    The file is over 7MB. Can OP upload it here? I downloaded it from the dropbox link (which, btw, took several minutes) and tried to upload it here but it says that it failed. I tried it the way Trevor and Hans suggested, and another way that I always use since the "paperclip" option stopped working, and they both failed.
    Last edited by gmr4evr1; 08-06-2017 at 06:39 PM.

  8. #8
    Registered User
    Join Date
    08-06-2016
    Location
    Oklahoma city, Oklahoma, USA
    MS-Off Ver
    2016
    Posts
    30

    Re: Need Help Speeding up my Macro.

    Quote Originally Posted by gmr4evr1 View Post
    The file is over 7MB. Can OP upload it here? I downloaded it from the dropbox link (which, btw, took several minutes) and tried to upload it here but it says that it failed. I tried it the way Trevor and Hans suggested, and another way that I always use since the "paperclip" option stopped working, and they both failed.
    Yeah like I said before, its a large file and I wasnt able to load it to this site which is why i gave the dropbox link. Thanks for the help all for showing me how to upload though.

    I will try and make some time making a demo version and upload it so it wont be so large.

  9. #9
    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,508

    Re: Need Help Speeding up my Macro.

    Not everyone can or will download files from a file sharing site.

    Point is, we don't want/need the live file, just a representative sample. Again, not everyone wants to use their data allocation or disk space for downloading files.

  10. #10
    Registered User
    Join Date
    08-06-2016
    Location
    Oklahoma city, Oklahoma, USA
    MS-Off Ver
    2016
    Posts
    30

    Re: Need Help Speeding up my Macro.

    Well I just answered my own question.

    Turns out that when I pre-filled a bunch of formulas in a little over a 1000 rows by about 10 columns or so, for reasons I dont understand it slowed down my macro for filtering. I filled that many rows with formulas for anticipation while working in case that many rows were needed. I cut out about half those rows and the macro runs much faster like I was expecting. Guess for now ill just reduce the amount of rows that require formulas, then the user can just copy and past previous row with formulas to the new row if needed. But in all honesty, so far 500 rows were never all used, so I think 500 rows full of formulas is good enough.

    Thanks for the help and sorry bout the attachment dilemma. Will rep those that I think helped me out.

  11. #11
    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,508

    Re: Need Help Speeding up my Macro.

    You're welcome. Thanks for the rep.


    If you can convert your data to a Structured Table, you shouldn't need to pre-fill / pre-prepare any rows/cells. The Structured Table wold autofill formulae and formatting to new and inserted rows.

  12. #12
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Need Help Speeding up my Macro.

    I'm glad you were able to get it figured out. Thank you for the rep.

+ 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] Speeding up Macro
    By booney440 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-09-2017, 10:41 PM
  2. Help speeding up a Macro
    By jbrooks1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2016, 12:57 PM
  3. [SOLVED] Speeding Up Macro
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-03-2015, 11:15 AM
  4. [SOLVED] Speeding up my macro
    By jsuarez199 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-03-2013, 10:52 AM
  5. [SOLVED] Help in speeding up my macro!
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2013, 12:04 PM
  6. Speeding up a macro
    By Mister P in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-20-2010, 02:50 AM
  7. Replies: 3
    Last Post: 07-20-2006, 02:55 PM

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