+ Reply to Thread
Results 1 to 6 of 6

Optimizing code time running

  1. #1
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Question Optimizing code time running

    In terms of execution speed, is it better to have one big macro performing many tasks or many small macros performing a few number of tasks?
    Last edited by Pichingualas; 03-02-2012 at 12:14 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Optimizing code time running

    You can only run one at a time so it won't really make any difference as far as I know. The general rule is to try and break your code down into small chunks to make it easier to understand and debug and to avoid repetition if you have bits that can be reused.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Optimizing code time running

    Ok but breaking down the code into smaller chunks won't have any effect on the time they all take to run then?

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Optimizing code time running

    I don't think so. Avoiding selecting cells, switching off calculation when you can and screen updating are the places to start.

    Dom

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Optimizing code time running

    Do as little writing operations as possible.



  6. #6
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Optimizing code time running

    Ok thanks guys, I guess I can't improve the time it takes unless a use a better computer, since I've done all the things you say. Thanks for your replys.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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