In the VBA editor, click Insert, then module. This starts a new public module. Then with the module selected click Insert and Procedure, then a menu comes up from which pick public sub. Then that sub.
To run it from your form, just write the name of the public sub on a line for the relevant...