+ Reply to Thread
Results 1 to 5 of 5

Order of subs vs macro speed

  1. #1
    Registered User
    Join Date
    08-10-2020
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    81

    Red face Order of subs vs macro speed

    I was just wondering: does the order of Subs (or Functions) in Excel
    make any difference regarding the speed of my macro?

    Let's say I have my Subs ordered like this:
    Sub Main()
    Sub Extra1
    Sub Extra2
    Sub Extra3

    Does it make any difference for the speed of my macro in which order Subs are placed?
    Maybe there's some kind of rule for the order of Subs for faster processing by Excel I don't know about?

    Just curious, thanks in advance ;-)

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    896

    Re: Order of subs vs macro speed

    Don't think the order matters, what matters is how each macro is written that would be where the speed is affected.
    Like having alot of .Select or .Activate will slow things down.

    If you are looking to speed things up, post your macros or sample workbook as stated in the yellow banner and im sure you will get some responses on improvements if needed and suggestions on other methods to try.
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    Re: Order of subs vs macro speed

    Not that I am aware of. In a large project, I would normally go for a structured programming approach which can mean a lot of called subroutines with specific input, output and processing. The routine wouldn't be called unless needed and because it has one way in and one way out, it's easy to isolate where problems are occurring … you know what went in and you know what should come out, so why hasn’t it?

    I quite often have one subroutine or function to a module, but I will group them together in a module if they are part of an overall process.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    08-10-2020
    Location
    Netherlands
    MS-Off Ver
    2019
    Posts
    81

    Re: Order of subs vs macro speed

    Got it, thanks people! :-)

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    Re: Order of subs vs macro speed

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. How to avoid cell SELECTION but still format cells to speed up the macro running speed
    By BeefyBerts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2018, 08:18 AM
  2. Question about call other subs from one macro
    By jnh0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2013, 04:16 AM
  3. RSA Subs Macro fails
    By DavidEagles in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-12-2013, 01:40 PM
  4. Module Subs executing Private Subs without prompt by code - Totally Lost
    By Ozan Ertem in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-26-2012, 05:31 PM
  5. Combine subs to run and appear as one in macro list
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-13-2009, 09:39 PM
  6. [SOLVED] Single Macro containing multiple subs
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2006, 09:25 PM
  7. execution subs not in logical order ?
    By Pierre via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2005, 05: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