+ Reply to Thread
Results 1 to 8 of 8

Speeding up the macro (defining a table)

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Speeding up the macro (defining a table)

    Hi, in the attached workbook, i have a simple macro that puts formulas into the sheet and filling down the values etc.
    Point is, that it take very long (and one of my workbook contains even 20 000 of the raw data). So my question is - is there a solution to my problem? It should make the same output but take much less time (because now its really useless). Please run the macro and see what i mean.

    The output what i need is the table from G2:Z to the downEnd (only the values) that i can paste in another workbook. I guess there should be a table defined inside the macro or something but i don't really know how to start. : If the code is not running I pasted it below
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Speeding up the macro (defining a table)

    try taking the column formula out
    its not needed and the calculations for that is large

    also replacing vlookup with index/match may improve performance
    here is link that taught me how index/match works and advantages over vlookup for large data sets like your example

    http://www.randomwok.com/excel/how-to-use-index-match/
    Last edited by humdingaling; 07-29-2013 at 02:26 AM.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

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

    Re: Speeding up the macro (defining a table)

    Turn off/on screen updating and check.


    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

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Speeding up the macro (defining a table)

    Hello mumsys,

    This macro will greatly speed up the process. Only the values are saved into the columns, no fomulas are created or evaluated, and the look ups can be be done at random.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Speeding up the macro (defining a table)

    Thanks Humdingaling, thats very nice

    Leith Ross, hi and thank You for the work. But i have some problems maybe because im using office 2007 and something do not work as at Your place.
    Firstly i had an error in line
    Please Login or Register  to view this content.
    but i changed Sheet2 to sheets("Mapping") and it worked. The same thing - I changed all of the Sheet1 and sheet2 to my workbooks names and ok. But on line
    Please Login or Register  to view this content.
    i get application-defined or object defined error. (here i also changed Sheet1 to sheets("sheet1")

    Best regards

  6. #6
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Speeding up the macro (defining a table)

    OK it worked i see my mistake in a few minutes ill get a feedback how it manage to work with lot of data

  7. #7
    Registered User
    Join Date
    07-09-2013
    Location
    Poland
    MS-Off Ver
    excel 2007
    Posts
    85

    Re: Speeding up the macro (defining a table)

    This is awesome! Easily adjustable and quick. Thank You Leith Ross!

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Speeding up the macro (defining a table)

    Hello mumsys,

    Glad you got it working. I am using Excel 2010 but none of the macro is unique to 2010. So, I am mystified by your problem.
    The Sheet1 and Sheet2 in the macro are the Excel Code Names for the sheets. These names are read only and can not be changed. This is how Excel and VBA keep track of them since the user can change the worksheet name.

    You are probably asking "Isn't a Sheet and a Worksheet the same thing?" Excel can have 3 different types of Sheets: Worksheets, Charts, and Dialog. Each of these has its own name property that the user can change to identify them.
    For Worksheets, the Worksheet name property defaults to the Sheet Code naem i.e., Sheet1, Sheet2, Sheet3. In the VB editor you will see the Sheet code name followed by the Worksheet name in parentheses, like this, Sheet1(Sheet1).

    When writing macros for other people, using the Sheet Code name is often a better choice than using the Worksheet Name, since the user may change the Worksheet name later on. By using the Sheet Code name, the reference will always point to the same Worksheet. This scheme has been used since Windows '95. I have attached a copy of the workbook with I macro I used for testing. It is the one you posted. See if runs on your system.
    Attached Files Attached Files

+ 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 my macro
    By jsuarez199 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-03-2013, 10:52 AM
  2. [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
  3. Speeding up a macro
    By Mister P in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 12-20-2010, 02:50 AM
  4. [SOLVED] Help with speeding up a vlookup macro
    By [email protected] in forum Excel General
    Replies: 3
    Last Post: 07-20-2006, 02:55 PM
  5. [SOLVED] Help with speeding up vlookup macro
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2006, 01: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