+ Reply to Thread
Results 1 to 8 of 8

Newbie here. Macro functions but extremely slow

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Newbie here. Macro functions but extremely slow

    Hello All!

    I have had so much help with these forums and was wondering if someone could help me with my macro. I am a civil engineer with no programming knowledge. Most of the vba macro I created is by using codes from this forum or by recording in excel and extending it a little further. It has worked so far however it takes hours and hours to process all the files. I now have a folder with over 600 files that I have to process and I have let it run overnight and it has successfully however I cannot present it to the users since it is time consuming. Couple of specific issues that I as a non-programmer can mention is:

    1. Module 37 is the master list of all the macro I use --- I dont think this has any issues
    2. Call one is pretty straight forward - it imports all the csv like files into the current workbook -- Don't think this has any issues
    3. Call two (module 6) - calculates average speed and uniformity metrics. --- This is the one I think has major issues. Since the data is variable, I did not know how to mention "check for rows with values and calculate average". Instead, I calculate average of full columns or sometimes specific cell numbers which in this case I set it as 3600 rows. Then all the calculations are done cell by cell since I recorded macro and generalized. This macro takes a ton of time.

    4. Module 29 also is recorded and is time consuming.

    5. Module 33 is also recorded and takes time to copy and paste formula cell by cell.


    I was wondering if anyone out here could help/ guide? I have attached the macro for your reference. Thanks in advance!

    Sarah
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Newbie here. Macro functions but extremely slow

    First thing you should do is get rid of all the unneeded activating and selecting.

    For example, this gets rid of all the selecting/activating in the sub Two_Avg_Speed_Loop.
    Please Login or Register  to view this content.
    That should speed things up a bit, but I'm sure there are other things that can help.

    One thing I did notice was the array formula you are putting in 3,600 cells in column X, that's bound to take up some processing time.

    PS You might consider turning off calculations when placing the formulas in the cells.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newbie here. Macro functions but extremely slow

    That was super quick. thanks! I will try that and see if it speeds up. I am not sure if I have to hire a pro to rewrite the full code because processing 77 files took 28 minutes. And some folders have over 600 files!

  4. #4
    Registered User
    Join Date
    10-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newbie here. Macro functions but extremely slow

    Thanks, Norie! It did help to an extent. I hope I can make similar adjustments to other macros to speed it up further. Thanks! Any other pointers, anyone ????

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Newbie here. Macro functions but extremely slow

    I think to give any further specific help it might involve seeing a sample of the data you are working with.

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Newbie here. Macro functions but extremely slow


  7. #7
    Registered User
    Join Date
    10-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newbie here. Macro functions but extremely slow

    Hi, Norie! Thanks for the note. I could not attach a file in the reply so here is the link to the sample files.

    dropbox.com/s/sxkrlhmtsxopnev/NE.zip?dl=0 In the main tab I input the path to the (extracted data) folder and the macro should run. Thanks again for your time and help!

  8. #8
    Registered User
    Join Date
    10-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Newbie here. Macro functions but extremely slow

    Here are the cross post links at other places:

    mrexcel.com/forum/excel-q...ent-macro.html
    excelforum.com/excel-prog...mely-slow.html
    ozgrid.com/forum/showthread.php?t=191169

+ 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. Macro Tied to Complex Nested If Statement Extremely Inefficient/Slow - HELP
    By Umann51 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2011, 04:34 PM
  2. Extremely slow macro!
    By PSm1th29 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2010, 06:27 AM
  3. Excel is extremely slow now
    By Martindelica in forum Excel General
    Replies: 0
    Last Post: 05-01-2007, 08:32 PM
  4. Extremely slow file
    By Jay in forum Excel General
    Replies: 3
    Last Post: 07-10-2006, 08:19 AM
  5. [SOLVED] Workbook is now Extremely Slow
    By Dmorri254 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-03-2005, 02:19 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