Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
Is it best to program many subs and functions into one module or one sub per module resulting many modules? What are the pro and cons using, or efficiency in either of these methods. Thanks, -- webby2006 ------------------------------------------------------------------------ webby2006's Profile: http://www.excelforum.com/member.php...o&userid=36744 View this thread: http://www.excelforum.com/showthread...hreadid=567498 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
While I have not had any classes in programming, I keep one module,
mdlFunctions, with the functions that I will use frequently, then one other, mdlMain, module with the main program. If I have more that one program in a project I create a separate module for each program. My mdlFunctions is easily available to both routines and when I later go back to look for those functions it's easier to find them than if I had to search through all the "Main" modules. Another advantage of my mdlFunctions is that on starting a new project, I can simply import mdlFunctions and have a good start for what I usually need to do. Charles xl Geek webby2006 wrote: Is it best to program many subs and functions into one module or one sub per module resulting many modules? What are the pro and cons using, or efficiency in either of these methods. Thanks, -- webby2006 ------------------------------------------------------------------------ webby2006's Profile: http://www.excelforum.com/member.php...o&userid=36744 View this thread: http://www.excelforum.com/showthread...hreadid=567498 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
There are no hard and fast rules here but the idea is to try to keep things
organized as best you can. Sometimes these things get to be very large and it is not efficient to have everything in one module any more that it is efficient to have many, many modules. The best practice is to organize similar subs and functions together into modules that you have named. For instance I will often have a module called modProtection where I keep all of my protection and security procedures. I will have another module called modFormatting where I keep all of my procedures that deal with reformatting sheets. By grouping similar functionallity together it makes the program easier to debug. When something goes wrong I know where to look. -- HTH... Jim Thomlinson "webby2006" wrote: Is it best to program many subs and functions into one module or one sub per module resulting many modules? What are the pro and cons using, or efficiency in either of these methods. Thanks, -- webby2006 ------------------------------------------------------------------------ webby2006's Profile: http://www.excelforum.com/member.php...o&userid=36744 View this thread: http://www.excelforum.com/showthread...hreadid=567498 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
Although I am not a professional programmer I have been using VBA in Excel
for years. I originally put one or two subs in a module. Sounded good at the time but when I later went back to edit a sub I had a difficult time remembering what module it was in. I currently have all my subs that are related to a particular spreadsheet in one modules. Editing is much simpler now because I can go up to the drop down box that lists all of my subroutines, select the one I want to work on and it takes me right to it. I agree with the others that have indicated orgination is the key. So it basically boils down to whatever works best for you. For me one module with many subs fits best in daily practices. If I get to the point where I have a multitude of subs in a single module, I will probably do as someone else stated and separate subs with like functions into various modules. Haven't reached that point yet! Jeff Boyle Isothermal Community College "webby2006" wrote: Is it best to program many subs and functions into one module or one sub per module resulting many modules? What are the pro and cons using, or efficiency in either of these methods. Thanks, -- webby2006 ------------------------------------------------------------------------ webby2006's Profile: http://www.excelforum.com/member.php...o&userid=36744 View this thread: http://www.excelforum.com/showthread...hreadid=567498 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
webby2006 wrote:
Is it best to program many subs and functions into one module or one sub per module resulting many modules? What are the pro and cons using, or efficiency in either of these methods. Thanks, Keep functions somehow connect to each other in one module. Create as many modules as you need to keep structure of entire project clear. Read this http://www.answers.com/topic/cohesion-computer-science |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
many subs or many modules
Thank you for all your replies. I am glad I have not strayed too far from logically grouping similar routines into the one module like Jim has mentioned. i.e. all formatting in one module and files manipulation in another. Many many thanks. -- webby2006 ------------------------------------------------------------------------ webby2006's Profile: http://www.excelforum.com/member.php...o&userid=36744 View this thread: http://www.excelforum.com/showthread...hreadid=567498 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Public, Private, Event modules, Forms modules,,, | Excel Programming | |||
ending subs | Excel Programming | |||
Basic question - modules and class modules - what's the difference? | Excel Programming | |||
When to code in sheet or userform modules and when to use modules | Excel Programming | |||
Class Modules vs Modules | Excel Programming |