+ Reply to Thread
Results 1 to 4 of 4

Modules- what to do with blank ones

  1. #1
    Registered User
    Join Date
    08-21-2007
    Posts
    90

    Modules- what to do with blank ones

    A newbie question. I have learned advanced Excel and VBA quickly thanks to board members here, so I now have a gret Workbook, but need to clean up my work so I can distribute it.

    I have 15 modules, but only VBA code in 4 of them.

    1) Should I copy paste all my subs into 1 module?
    2) Can I delete all of the empty modules?
    3) what did I do to get all the blank modules?

    Any links or explanations of where to go from here? Meaning what is and how to use a VBA Project; how to protect VBA code, how to protect a Project.

    Thanks,

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    1. You needn't move them unless you want to
    2. You can delete empty modules and should do so. Right click & delete.
    3. You add modules by clicking insert & selecting module, or by recording a macro.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-21-2007
    Posts
    90
    RoyUK,

    I eliminated all the blank modules.

    Do I gain anything by having all the Subs in one module (speed, security, less chance to be corrupted, etc)

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    It depends on the complexity of your spreadsheet.

    I like the arrangement suggested by Stephen Bullen et al in Professional Excel Development:
    • MEntry: Procedures called from toolbar buttons
    • MGlobals: Definitions of all public constants and variables
    • MOpenClose: Code required to open and close the application (called by Open and BeforeClose events)
    • MStandardCode: Code reused without modification from other applications
    • MSystemCode: One or more modules that implement application-specific processing
    • MUtilitities: Code used solely in development and maintenance of the the application

    That may be way more than you need for now, but think about separating code into functional groups.

+ 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