+ Reply to Thread
Results 1 to 4 of 4

Macros and Modules

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    Macros and Modules

    Hi all

    I'm a total newbie to this, trying to learn VBA on my own with no programming background whatsoever so I beg you to have patience...

    If I use the recorder to record two different macros, I noticed they get created in two different modules. Playing around with the Visual Basic Editor I realized I can write two macros (that have nothing to do with each other) in the same module, so I wonder: for n unrelated different macros, is it better to use n different modules (like the recorder does by default) or it's better to use just one module? Or it makes no difference?

    Thanks to all
    Last edited by VanniFucci; 03-15-2013 at 05:47 AM.

  2. #2
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Macros and Modules

    In small workbooks, that have very little VBA I just use one module. I do have a very large workbook that has around 20 modules with the code broken down into types in each of the modules (Get, Set, Check, Add, etc).

    As for the recorder creating new modules, it seems to me it does this when you record for the first time since opening the workbook. It will keep using the same one until you close and open the workbook again. That has been my experience anyway.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macros and Modules

    Tis true, my experience also...
    It will keep using the same one until you close and open the workbook again
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    03-14-2013
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Macros and Modules

    All clear thanks a lot!

+ 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