macro button

  • Thread starter Thread starter Phil Wagner
  • Start date Start date
P

Phil Wagner

I have a couple macros that I'd like the user to just press a button to use.

How do you create a button and assign it to a macro?

TIA
 
Right click on any icon on your toolbars and select customize from the
menu -it's at the end of that list-
The Customize window will appear
Go to Commands and select "Macro" from the categories window
Then drag and drop one of the customizable icons to the toolbar wherever you
want it to be
right click on the icon you just introduced into your toolbars
select assing macro
pick your macro
Close the customization window.

Say a loud and clear "KAPOW", and that will be it.

write if the kapow does not work.

Leo Rod
MIA- Fl, USA
 
Rod - I wanted the button to be in the spreadsheet, not on the toolbar. How
do you do that??

TIA

--
---
Phil
Leo Rod said:
Right click on any icon on your toolbars and select customize from the
menu -it's at the end of that list-
The Customize window will appear
Go to Commands and select "Macro" from the categories window
Then drag and drop one of the customizable icons to the toolbar wherever
you want it to be
right click on the icon you just introduced into your toolbars
select assing macro
pick your macro
Close the customization window.

Say a loud and clear "KAPOW", and that will be it.

write if the kapow does not work.

Leo Rod
MIA- Fl, USA
 
Tools>Customize>Toolbars, make sure that the Forms option is checked.

Drag the button off the forms toolbar onto the worksheet, you will
immediately be asked to assign a macro.

--
__________________________________
HTH

Bob

Phil Wagner said:
Rod - I wanted the button to be in the spreadsheet, not on the toolbar.
How do you do that??

TIA
 
in xl2003, I'd do:

View|toolbars|Forms
Then click on the button icon and draw on the worksheet.
Then assign the existing macro to this button.

(This is not the commandbutton from the Control toolbox toolbar.)
 
Open the edition view, and from the Toolbars item select "Control Toolbox"
This will open a toolbar
Select the "Command button" -it's the only one that looks like a button-
"Draw" the button by making a box anywhere on the spreadsheet where you want
the button to be.
Once it's created comes the "tricky part"
Right click on the button and select "view code"
Once it opens the VBA window copy the code from your macro -possibly on the
modules of your "personal.xls" workbook- and paste it into the blank space
under: "Private Sub CommandButton1_Click()" window on the workbook where you
want it inplanted.
-Be aware that this button will only run when you are using the workbook and
will not be stored on your personal.xls workbook where excel by default save
other macros.
Remove any extras "end sub" statements repeated at the end of the macro code
delete the name that you originally have for the macro and leave only the
button name.
close the vba window and save the spreadhseet.
test it.


Phil Wagner said:
Rod - I wanted the button to be in the spreadsheet, not on the toolbar.
How do you do that??

TIA
 
sorry, I forgot to include before saving it to make the button functional,
open the "Control toolbox" toolbar and select "Exit desing mode" this will
turn the button functional allowing to edit the spreadsheet and not the
elements or properties of the spreadsheet.
 
Thanks! This worked fine.

---
Phil
Bob Phillips said:
Tools>Customize>Toolbars, make sure that the Forms option is checked.

Drag the button off the forms toolbar onto the worksheet, you will
immediately be asked to assign a macro.

--
__________________________________
HTH

Bob
 
Back
Top