Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel macro button 1

Status
Not open for further replies.

eit09

Civil/Environmental
Jul 8, 2009
183
I have never written a macro before. I would like to start to learn how macros work. I used the macro record button to clear certain cells. I can go into the macro dropdown list and click run and the macro works perfect. I want to know how to add a button to run the macro vs going in the toolbar and clicking run every time. Can anyone explain how to insert these and name these buttons? Could not find this information in the help menu! Also I have attached an example so you can see the macro I recorded.

Thanks in advance!
 
Replies continue below

Recommended for you

Use the Customize command on the toolbar, select "Macros" which pulls up a choice between a custom menu item or custom button. Click the custom button and drag it to one of your toolbars, right click it and "Assign Macro" to it.

TTFN

FAQ731-376
 
In addition to adding custom buttons to toolbars (handy for tasks that might apply for any workbook), you can also add a custom button to a worksheet. Having it on the worksheet limits the scope of the macro that you have to worry about and may make the relationship of the button and worksheet more obvious.

You can even assign macros to "shapes" as well. An old trick is to create a transparent rectangle (without border) and lay it over a cell. Assign a macro. Now you can click on the cell to run the macro. I use this a lot for the purpose of clicking on the cell in order to open a page linked to that cell.
 
You can also add a button to your spreadsheet. In the Forms menu, you can add buttons and assign a macro to run when you click it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor