Forgot how to assign a macro to a button object

  • Thread starter Thread starter Steve Conover
  • Start date Start date
S

Steve Conover

I created a macro, now I've forgotten how to assign it to a button
object in the workbook. I tried right-clicking on the sizing handle,
but the shortcut menu does not have "Assign Macro" on it. (The help
system assumes it does and proceeds from there, leaving me behind.)

Any suggestions?

Thanks,
Steve
 
You used a commandbutton from the control toolbox toolbar.

Delete that one and add the button from the Forms toolbar.
 
It depends whether the button is a user form button from the "Forms"
menu or a control button from the "Control Toolbox" menu. If it is a
forms button then it will have assign macro in the pullbown list so i
am assuming you have used a control button.

In this case the macro is hard coded to the button. You will either
need to copy and paste the code into the buttons routine, right click
then select view code, or double click on the macro.

Alternatively you can run the macro from the buttons code. To do this
place the following code behind the button.


Private Sub CommandButton1_Click()

Call "macro name"

End Sub

where "macro name" is the name of your macro but don't put it in
commas.

Hope that helps
 
Back
Top