WELCOME TO THE BOARD!
In order to get your macro to run, you must have an EVENT trigger the macro. Once event is the ACTIVATE event. When your UserForm is activated, the macro will run. You will find several different events available for different objects.
To put your code in VBA, open the Visual Basic Editor. Double-click on your UserForm. Push the F7 key on your keyboard. You will see two pull-down menus on the right near the top. Select USERFORM in the first pull-down menu and select ACTIVATE in the second pull-down menu. You will now see something like this:
Private Sub UserForm_Activate()
End Sub
Put your code between the top line and End Sub. Did this help?