A common practice for beginning developers is to place the macro processing code in the OK (or Apply) button click event sub of a User Form. While this may be easy, and keeps everything in one spot, it is not recommended. The only code in your User Forms should be the code required to collect and verify user inputs.
The actual processing code for your macros should be placed in separate code and/or class modules. Designing your processing code with multiple functions and subs divided logically in to different modules and classes promotes reusability and portability.