Module Usage

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi - I have a general questions about whether it's best to put all your code into 1 macro, or create separate modules for each procedure and then call them? thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Note that you can have multiple procedures/functions within the same module (you do not need a separate module for each procedure).

A lot of it is personal preference. I tend to not like to overwhelm my procedures and make them too big, so I like to break them up into logical chunks. It can make debugging them a little easier too.
Another reason for doing this is you can make your procedures reusable, especially if you make them generic and feed in parameters. So you can improve efficiency that way.
 
Upvote 0
As Joe said it's personal preference.
I tend to prefer all code in one procedure, with the exception of a few functions
 
Upvote 0
One of the tenants of Structured Programming is that each routine should do one thing.
So, large routines should be avoided and replaced with routines that call many different small routines when needed.

(Now I need to go see if I implied that Structured Programming is a landlord. :) )
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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
Back
Top