I assume that you used a command button from the "Controls Toolbox"
The "Forms" one would have asked you to assign the macro when you
created the button. You could just delete the button that you have and
use one from the "Forms" toolbar.
Or, if you want to keep the one you have.....
Right click on it.
Select "View Code"
Between the Sub and End Sub, just type in the name of your macro.
On a button from the Forms Toolbar you can right click and assign a macro
If you have a button from the controltoolbox
Press the first button on the controltoolbox toolbar to go into the design mode
Double click on the button you placed on your worksheet.
The VBA editor will open with this
Private Sub CommandButton1_Click()
End Sub
You can place the code in the event or place the macroname in the event.
Press Alt-q to go back to Excel and press the first button on the controltoolbox again to exit the design mode