+ Reply to Thread
Results 1 to 7 of 7

Slow Load and running with VBA and Vlookups

  1. #1
    Registered User
    Join Date
    11-25-2015
    Location
    Manitoba
    MS-Off Ver
    2016
    Posts
    36

    Slow Load and running with VBA and Vlookups

    Hello

    Since I have had great help from experts here I thought I would see if anyone has ideas or can assist.
    I have a 100 meg file (grows and shrinks) and am not in a position to transfer over to Access yet and hoping the business will in time but my problem is it takes approximately 10 mins and longer to load the excel file and even longer to run the VBA code when I press the update command button. From columns G to R are different vlookups from different workbooks that need to run and the code works but as mentioned it is extremely slow.
    Anyone have ideas to speed the code up?

    Here is the code I am using and I adjusted the vlookups to not show the actual path but as a reference to what is done.

    Please Login or Register  to view this content.
    Last edited by bbqqsmokeman; 10-04-2017 at 12:09 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Slow Load and running with VBA and Vlookups

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    11-25-2015
    Location
    Manitoba
    MS-Off Ver
    2016
    Posts
    36

    Re: Slow Load and running with VBA and Vlookups

    mehmetcik, thank you for taking the time to assist and I really appreciate it. I updated my code with your revisions and find the code is a lot cleaner (something I still need to work on but am learning) and it did speed it up by approx. 3-4 minutes but its still taking a lot of time for the file to load, update when I depress the 'update' button and even more time to save when I choose save and close. I don't know if there is anything else that can be done at this point since it is a huge file being 100 megs in size and won't shrink dramatically.
    Again thank you for taking the time and effort and if you or anyone else have any other ideas I would appreciate the advise.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Slow Load and running with VBA and Vlookups

    What 'might' help is instead of all those formulas is to build the entire array in memory and dump it all in one go on the worksheet.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Slow Load and running with VBA and Vlookups

    Hi,

    You have several columns where you look up the same values repeatedly but return a different column each time. It is much more efficient to add a MATCH column to find the right row and then several INDEX formulas. For example, rather than this
    Please Login or Register  to view this content.
    (condensed a little) which is looking up the same column H values 5 times, you might use column S for a MATCH formula and then use 5 INDEX formulas
    Please Login or Register  to view this content.
    You can repeat this for the other columns that lookup the same values.
    Also note that there is no point to turning calculation to manual if you then assign the formula to multiple cells at once. That only helps if you assign the top row, then use FillDown and then turn calculation back to automatic.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Registered User
    Join Date
    11-25-2015
    Location
    Manitoba
    MS-Off Ver
    2016
    Posts
    36

    Re: Slow Load and running with VBA and Vlookups

    All,

    After multiple attempts to improve the speed of this massive file and all the help everyone has given me I decided to split the file. So what I did was take the 100 meg file and made a new xlsx file and copied all the data as values to the new workbook and am now using it as a 'database' and yes I hate to call it that since excel is not meant to be a database but it will do for now till I can build the access database if they are willing to accept the obvious changes that are required. So this way the 'database' is now just that, its only a database aka repository in my world. I then took a new workbook and created the headers with no data below it. When the data gets filled in they run from a command button to do the Index Match formulas (thank you xlnitwit for your assistance and the code) and also thank you mehmetcik as well for the alternative workaround as well but the Index Match does perform faster so I went with that version. Both are good methods but I had to go with the faster version. So then when they run the code from the command button it populates the rows as per the code and I took it a step further to transfer the data to the repository with the following code:
    Please Login or Register  to view this content.
    This method works the fastest as all the formulas are now in the small version and then transferred to the master repository aka archive aka database as values without taking along time. It's an extra workbook created but it does what is needed and anyone can still retrieve the data from the MTUMaster that houses all the values.
    Again, thank you all for your help and ideas and yes bakerman2 thank you as well as I did try the array into memory also.
    I am closing this as solved thanks to everyone for the great ideas, alternative codes and making me think deeper and not so one dimensional all the time

    Now to convince the powers that be too start using Access for alot of these workbooks that are being treated as databases.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Slow Load and running with VBA and Vlookups

    Glad you got it sorted out.
    Thanks for 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. Excel Crashing & Operating Very Slow After Inserting VLOOKUPS and MACROS
    By nathandavies9 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-23-2017, 10:00 AM
  2. Macro is running real slow and makes navigating the worksheet really slow after execution.
    By MichWolverines in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:29 PM
  3. Macro to hide/unhide cells not running or running slow
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 04:22 PM
  4. App w/VBA code from '03 slow to load in '07
    By SAElmer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2010, 05:24 PM
  5. Excel 2007, Slow to Load and Save
    By excel199 in forum Excel General
    Replies: 7
    Last Post: 07-21-2010, 03:18 AM
  6. Excel is very slow to load files
    By rgrstvr in forum Excel General
    Replies: 12
    Last Post: 12-20-2009, 09:25 AM
  7. [SOLVED] why my excel load slow?
    By please help me..urgent in forum Excel General
    Replies: 1
    Last Post: 02-24-2005, 02:06 PM

Tags for this Thread

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