How do i add macro in excel to button

how do i add macro in excel to button


Share Send to a friend Watch Report
 
 

2 Posted Answers
Order by

 
4 helpful answers

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.

Posted 2007-08-23T12:16:53Z
Helpful?(1)
Rated as Best Answer
 
5 helpful answers
I have a great idea -Changing the world ..., what to do? See Tim Berners-Lee's (founder of www) FAQ section.

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_World
End Sub

6) Switch Design mode off

7) Press button -> Pop-Up is displayed with conteent "Hello World"

Posted 2007-08-23T13:29:47Z
MikeBeer was invited by Yedda to answer this question.

Sign in to participate

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).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Q:

Embedding Macro in and Excel Workbook

I am very new to creating excel Macros. I used a guide to create a Insert Date macro. I then inserted a small picture of a ...
Submitted by Krissy   2 years ago.
  • viewed 1191 times
Last answer posted 1 year ago by SpreadsheetsDirect


Q:

VB script for Excel spreadsheet printing

I wish to write a vba script I can run for a spreadsheet in MS Excel that only prints only the rows for a column (let's say ...
Submitted by JtotheA   2 years ago.
  • viewed 2136 times
Last answer posted 2 years ago by JtotheA


Q:

Removing all rows that have a "0" value

I am creating a macro in Excel 2007. What I would like it to do is to remove all lines that have a zero value ("0"). Can you help ...
Submitted by Sage   2 years ago.
  • viewed 1239 times
Last answer posted 2 years ago by JtotheA



» More...

Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
ADVERTISEMENT
AOL Autos Q&A is powered by Yedda an AOL Company
Copyright © 2006-2009, Yedda Inc. and respective copyright owners