how do i add macro in excel to button
Here's how you do it in Excel 2003:
1. record the marco.
2. right-click anywhere on a toolbar, and choose "costomize" (the last option).
3. on the top, click the "Commands" tab.
4. On the "Catrgories" list on the left, select "Macros" (third from the bottom).
5. On the right side, "Costom Botton" will appear -- drag it to the place you want it to be on the toolbar.
6. One it's on the toolbar, right-click this new button and select "Assign Macro" (the last option).
7. Choose the macro you recorded in stage 1.
I assume you want to add a button to the grid (cell) and process an existing macro when you click the button (and you use Office version different from "Office 2007"). Moreover the existing macro looks like this:
Private Sub Hello_World() MsgBox "Hello World"End Sub
---------------
Steps:
1) Right-mouse click on the toolbar area -> list of toolbars opens -> check "Control Toolbox" (On the top, a toogle button is displayed to switch design mode on/off).
2) Press the "Command Button" icon
3) Add a button to the area/cell of the grid
4) Doubleclick the button
-> Visual basic displays:
Private Sub CommandButton1_Click()
End Sub
5) Add your existing macro to the sub "CommandButton1_Click"
Private Sub CommandButton1_Click() Hello_WorldEnd Sub
6) Switch Design mode off
7) Press button -> Pop-Up is displayed with conteent "Hello World"
The search for people who can answer your question continues for as long as needed - until you find the answer you were looking for.
When an answer is posted by someone who was invited (byYedda or by yourself) to answer your question, their answer is marked with a yellow "invited by Yedda".
To be invited to answer other people's questions in your areas of knowledge and interest, be sure to list your favorite topics:
» My Settings My Topics.
Of course, the more helpful your answers are, the more likely you are to be invited to future questions...
Got an answer for efi1234? Would you like to comment on the posted answers, or vote for the one which you think is the best?
Sign up for a free account, or sign in (if you're already a member).
Other people asked questions on similar topics, check out the answers they received:
Other people asked questions on various topics, and are still waiting for answer. Would be great if you can take a sec and answer them