Multiple Modules vs Sub-Procedures in a single Module

bprisk

New Member
Joined
Feb 4, 2011
Messages
22
I've got - in my humble opinion - a wonderful macro that I've developed with lots of searching and learning from this site. All of the code resides in "Module1" in a number of sub-procedures. I've seen other folks develop their code using multiple modules with essentially one sub-procedure in each module. Is there a benefit to either approach? Is there a "best practice" method? Or is it just personal preference?

I'm getting ready to dive into combining code in Access with some of the procedures I built into the Excel code, and would like to make the "new" program cleaner.

Thanks!

Brad
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

francoisdublin

New Member
Joined
Jan 23, 2014
Messages
32
It can make sense to group related macros in one module for clarity or because you can then copy the module to another workbook and have all those related macros together.
Another consideration is that some declarations you make at the start of your macros can be limited in scope to just the current module or public to all modules. When you make a declaration, the scope can also be on a macro-only level.

I wonder what others will say.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,088
Messages
5,599,664
Members
414,325
Latest member
kfg1287

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top