Module Questions

LNG2013

Active Member
Joined
May 23, 2011
Messages
466
Hello,

I have several different macro codes that do different things, currently they are all in one module. Should I be using a different module for each one of these?

What benefit does it have to use different modules?

Do I need to set each Module to Auto_Run in order for them all to run, if I were to break them up into seperate modules.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi LNG2013

Welcome to the board

I am sure many here have a preference but I find it cleaner and tidier to have multiple modules, once you have your macro's set you can then run them in the order you wish from one further macro as the example below

Sub runmymacros()
macro1
macro2
macro3
etc
etc
end sub
 
Upvote 0
Thanks Swaink! I really appreciate your feedback! A technical question though, does using seperate modules allow me to use the same variables. Like currently in my coding I have about 9-10 seperate scripts all have different variables like x, y, z.


Hi LNG2013

Welcome to the board

I am sure many here have a preference but I find it cleaner and tidier to have multiple modules, once you have your macro's set you can then run them in the order you wish from one further macro as the example below

Sub runmymacros()
macro1
macro2
macro3
etc
etc
end sub
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

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