If you want to create a function, code must be written in the module. Or, if there is a reference to this code in the relevant Excel library, the code should be written in the module.