Macro Location Control

Andy Pilkington

Board Regular
Joined
Jan 23, 2014
Messages
87
Office Version
  1. 365
Platform
  1. Windows
I have a number of spreadsheets with many macros, one in particular with nearly 400. Whilst the sheet and the macros work fine, when I edit macros I note that the later ones are "saved" in separate modules. My tidy mind says that it would be neater and easier to search and edit if they were all in the same place/module.

Please can someone explain the purpose of modules and if there is a process whereby I can consolidate all macros in one place?

Thanks in anticipation.
Andy
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
There are three kinds of modules:
- Class Modules are for creating custom objects. It doesn't sound that those are applicable for this question.
- Userform code modules. Userforms are essentially class modules mixed with a user interface, again not applicable.

- Object Modules, like ThisWorkbook or the code module for a sheet. Event code for that object must be in this kind of module. The code for ActiveX controls has to be in the module for the sheet where the control lives.

- Normal modules. It sounds like this is what you are working with. A macro can be in any normal module and still be called with normal syntax.
With 400 macros. I would put them in different modules for the reason you mentioned, organization. Looking through a "pile" of 400 macros for the one that I want to edit is hard. (Plus my general approach to computers that when things (sheets, modules, workbooks, audio files) get too big, odd and bad things crop up.)
I would put those macros in different modules divided either by purpose or by alphabet.
You can think of different modules like different shelves in physical library of books. You can either organize your library by topic or alphabetically.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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