ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Attach Macro to button? (https://www.excelbanter.com/excel-programming/393875-attach-macro-button.html)

Fritz

Attach Macro to button?
 
I know how to design a button, and I know how to record a macro but I can't
figure out how to attach the macro to the button?


David Hilberg

Attach Macro to button?
 
Are you using xl2003 or earlier? Is the button on a command bar (not
embedded in a sheet)? If yes to both:

Tools Customize
Right Click the button
Choose "Assign Macro"

- David

On Jul 21, 12:44 pm, Fritz wrote:
I know how to design a button, and I know how to record a macro but I can't
figure out how to attach the macro to the button?




Fritz

Attach Macro to button?
 
Using XL2003. The button is my designed embedded in the worksheet.

"David Hilberg" wrote:

Are you using xl2003 or earlier? Is the button on a command bar (not
embedded in a sheet)? If yes to both:

Tools Customize
Right Click the button
Choose "Assign Macro"

- David

On Jul 21, 12:44 pm, Fritz wrote:
I know how to design a button, and I know how to record a macro but I can't
figure out how to attach the macro to the button?





JLGWhiz

Attach Macro to button?
 
One way to do it is to call it via the click event:

Private Sub CommandButton1_Click() 'Or whatever name
myMacro 'Your macro name here if it is in the standard module
End Sub

If your macro is in a sheet you might have to use Run (macro name)

"Fritz" wrote:

Using XL2003. The button is my designed embedded in the worksheet.

"David Hilberg" wrote:

Are you using xl2003 or earlier? Is the button on a command bar (not
embedded in a sheet)? If yes to both:

Tools Customize
Right Click the button
Choose "Assign Macro"

- David

On Jul 21, 12:44 pm, Fritz wrote:
I know how to design a button, and I know how to record a macro but I can't
figure out how to attach the macro to the button?






All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com