ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to button (https://www.excelbanter.com/excel-discussion-misc-queries/151156-macro-button.html)

Fritz

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?

Stephane Quenson

Macro to button
 
Fritz,

In order to attach a macro to your button, open the Visual Basic editor
(Shift-F11) then click on the sheet containing the button, then click the
down arrow of the combobox showing General, and select your button. Normally
Excel will create a new routine called Private Sub CommandButton1_Click().
Simply insert the name of your macro with ventual parameters below that line.
If you want to associate your macro to another event of this button, select
the event on the second combobox at the top.

Stephane.

Kevin

Macro to button
 
Fritz,
Right click on any blank area of the "Menu bar" and choose "Customize..."
In the resulting "Customize" dialog box with the "Commands" tab selected
under "Categories:" choose "Macros"
In the right hand pane, drag the smiley face button to where ever you want
it on your menu bar or in your menus.
DO NOT close the "Customize" dialog box.
Right click the new smiley button, at the bottom of the list is "Assign
Macro..."
The "Assign Macro" dialog box opens with your list of macros to choose form.
Hope this helps.
-Kevin

"Fritz" wrote in message
...
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

Macro to button
 
I don't think this is what I want. I want to design/draw my own "box" on a
woorksheet. Then I want to assign a macro to it to print the "print area" of
the work sheet.

"Kevin" wrote:

Fritz,
Right click on any blank area of the "Menu bar" and choose "Customize..."
In the resulting "Customize" dialog box with the "Commands" tab selected
under "Categories:" choose "Macros"
In the right hand pane, drag the smiley face button to where ever you want
it on your menu bar or in your menus.
DO NOT close the "Customize" dialog box.
Right click the new smiley button, at the bottom of the list is "Assign
Macro..."
The "Assign Macro" dialog box opens with your list of macros to choose form.
Hope this helps.
-Kevin

"Fritz" wrote in message
...
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?





Gord Dibben

Macro to button
 
You can use any object you want and assign a macro to it.

A picture, a piece of Wordart, a button from the Forms Toolbar, a drawing from
the Drawing toolbar, a photo of your mother.................


Gord Dibben MS Excel MVP

On Sat, 21 Jul 2007 15:46:00 -0700, Fritz
wrote:

I don't think this is what I want. I want to design/draw my own "box" on a
woorksheet. Then I want to assign a macro to it to print the "print area" of
the work sheet.

"Kevin" wrote:

Fritz,
Right click on any blank area of the "Menu bar" and choose "Customize..."
In the resulting "Customize" dialog box with the "Commands" tab selected
under "Categories:" choose "Macros"
In the right hand pane, drag the smiley face button to where ever you want
it on your menu bar or in your menus.
DO NOT close the "Customize" dialog box.
Right click the new smiley button, at the bottom of the list is "Assign
Macro..."
The "Assign Macro" dialog box opens with your list of macros to choose form.
Hope this helps.
-Kevin

"Fritz" wrote in message
...
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 11:01 PM.

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