+ Reply to Thread
Results 1 to 6 of 6

improving functionality of lengthy macro

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    Panama
    MS-Off Ver
    Excel 2007
    Posts
    90

    improving functionality of lengthy macro

    Good day,

    I am looking for some simple advice,

    I did my undergrad in computer science however we always worked with simple programs (about 100 - 200 lines of code tops)

    For work I am making an excel macro that seems to get larger every day and I am starting to get lost in my won code ...

    or at least it takes me a while to find the place I'm looking for ....

    what is the best way to organize my code?

    I try using comments for every few batches of code, however I am getting close to 1000 lines of code,

    I would think dividing my code into sub functions and calling them would be better,

    any other suggestions?
    Last edited by Zealotwraith; 07-26-2013 at 11:28 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Simple looking for advice

    Administrative Note:
    • We would love to continue to help you with your query, but first, before we can proceed…
    • Please see Forum Rule #1 about proper thread titles and adjust accordingly...
    • Please PM me when complete and this post will be removed which will reset the replies to zero…
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    12-27-2012
    Location
    Panama
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: improving functionality of lengthy macro

    would it be better to add a module or just add a sub underneath it?

    is there a difrence between creating it as a sub and a function other than restriction of where to call i from (user VS code)

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: improving functionality of lengthy macro

    I think you are on the right track. Dividing your macro up into smaller Sub's that you call could help in the trouble shooting of the code.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Now when the first Sub runs, in order, the subsequent Sub's will be called.

    If the Sub's get out of control, in other words, many of them, you can highlight (for instance) CalledOne in the first Sub and then select Shift + F2 which will take you to that sub.

  5. #5
    Registered User
    Join Date
    12-27-2012
    Location
    Panama
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: improving functionality of lengthy macro

    Thanks Jeff,

    and thanks for the key shortcuts (always nice as well)

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: improving functionality of lengthy macro

    You're welcome…glad you have a workable solution and thanks for the feedback...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 4
    Last Post: 12-07-2012, 11:49 AM
  2. A simple question requiring a simple answer
    By Pedros in forum Excel General
    Replies: 3
    Last Post: 07-18-2006, 06:45 AM
  3. [SOLVED] Advice on simple mod Req
    By Ledge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2006, 09:00 AM
  4. Make it more simple or intuitive to do simple things
    By Vernie in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-16-2005, 12:06 AM
  5. Posting data from a simple form to a simple database
    By clacka in forum Excel General
    Replies: 0
    Last Post: 01-30-2005, 04:37 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