Code Modules

A code module can contain one or more procedures where a procedure is a subroutine or function.
Provides a way of organising your code
It is good practice to create several small subroutines or functions rather than one extremely long one.


Different Types

Workbook and Worksheet -
Userform Modules -
Class Module -
There are three different types of code module, standard, class and userform.
Code can be added to Events procedures which can be found within workbook, documents etc.


Important

You can easily drag and drop modules between projects.
After making significant code changes it is always worth exporting your modules, deleting them from the project and then importing them again.
You cannot have two procedures or functions with the same name in the same module although you can in different modules.
When you record a macro a new standard module will be inserted automatically for you.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext