+ Reply to Thread
Results 1 to 11 of 11

Macro performance

  1. #1
    Registered User
    Join Date
    03-09-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    85

    Macro performance

    Hi,

    I have macro it will compare data in sheet1 and sheet2.Then it will load unmatched records to another shett.
    But i have some lakshs of records approx 1lakhs records.When i run macro it is taking so much time.
    How to improve the performance of macro.It is not possible to get results with in minutes.My macro taking alomost 2 to 3 hours finally it is hanging.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Macro performance

    If possible, please share the code...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

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

    Re: Macro performance

    Code? ....
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    03-09-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Macro performance

    Below is the code,
    below is the code
    Please Login or Register  to view this content.
    This code is developed by one of the forum member.Thanks for his help.Only problem is i have lot of records it is taking time and finally hanging.If you have less number of records
    like 20000 ok but i have nearly some lacs of records

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Macro performance

    It is a cryptic coding to my eyes

    I am stepping back and I hope protonLeah / someone else will suggest speedup method.

  6. #6
    Registered User
    Join Date
    03-09-2014
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Macro performance

    If It is not possible with the same code.any one can provide another code for speed up the process

  7. #7
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Macro performance

    You could try something simple like stopping & starting interfering things like screenupdating etc. If you need to calculate when the macro's running, comment out Application.Calculation lines
    Cheers

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macro performance

    Hi,
    A few things that may help to improve the performance:
    1. store concatenated values in the next free column on sheet 1, 2. This way avoid multiple loops trough all cells in the respective row. Also I would use one loop to construct a string that will use with CONCATENATE formula with calculations stopped (see also 2.)
    2. Use vlookup with calculation stopped and then calculate (it will take some time of course). Convert formulas to values after calculation (single statement)
    3. no need to loop through each cell in the row in sheets 3,4 to populate with the values from sheet 2, 1. Use one statement for the entire range. Note that for me it look like you overwrite the value in the last cell in the row with "Not present in sheet"
    4. I don't see the use of Var array.

    Just my two cents. without data it's hard to suggest different implementation
    Last edited by buran; 03-21-2014 at 04:30 AM.
    If you are pleased with a member's answer then use the Star icon to rate it.

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

    Re: Macro performance

    To attach a Workbook
    Do not post a workbook with thousands of rows of data, just enough to step through the macro.
    (please do not post pictures of worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"


    Explain what the macro is actually doing with the data...

    By the way, what is: lakshs in English??

  10. #10
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macro performance

    Quote Originally Posted by protonLeah View Post
    By the way, what is: lakshs in English??
    I was curious too and googled it. lakh=100000 http://en.wikipedia.org/wiki/Lakh

  11. #11
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: Macro performance

    The reason why its take so long is it is loading and deleting the data over and over. toravietl you need to use arrays so you don't keep reloading the same columns over and over.

    toravietl is loading all values of each column in sheet 1 then compares it against each column of data in sheet2, if it finds a match it moves onto the next column, if it doesn't it puts in sheet 3 in the corresponding column. Then does it vice versa on sheet 4.

+ 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. VBA Arrays macro performance
    By sepi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2013, 08:21 AM
  2. [SOLVED] looking for a way to increase macro performance
    By s4driver in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-27-2013, 01:48 PM
  3. Poor Macro Performance
    By ckm08 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-07-2011, 04:36 AM
  4. Irregular Macro Performance
    By lostit in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 07-23-2009, 04:17 PM
  5. poor macro performance
    By parscott@holonics.ca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2006, 09:05 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