User forms have a visual component and an associated code module that can be edited using the VBA IDE.
- Double-click any control in the UserForm window to open the Code window.
The code window is scrolled to show the code associated with the control you double-clicked. If no code is associated with the control, a function for the default event of the control is added.