How to Make a Button for a Macro in Excel

Excel macros are designed to automate processes on a spreadsheet or perform commands on Excel data. You create the actual code for the macro using Visual Basic for Applications, a programming language included with Excel 2010. Normally, to run a macro you will need to choose it from the "Macros" window or press a combination of keys that you assign to that specific macro, but you can also create a button on the spreadsheet that anyone can press to run the macro. To get access to the controls needed to create a button, you will first have to add the "Developer" tab to Excel, as this is hidden by default.

Instructions

    • 1

      Open the Excel 2010 spreadsheet where you want to add a macro button. Click the "File" tab at the top of the screen and choose "Options" from the list items on the far-left side of the screen.

    • 2

      Select "Customize Ribbon" on the "Options" window. Locate the "Developer" entry in the rightmost column under the "Customize the Ribbon" heading. Click the empty box next to "Developer" to add that tab to the Excel ribbon. Click "OK" to go back to the spreadsheet.

    • 3

      Click the "Developer" tab at the top of the Excel spreadsheet. Locate the "Controls" area of the ribbon and click the "Insert" button. Under the "Form Controls" heading, select "Button." The cursor will change to a "+" sign.

    • 4

      Click and hold the mouse button anywhere on the spreadsheet. Drag the mouse to the left and you will see a box appear under the cursor. When the box is the size that you want the button to be, release the mouse button.

    • 5

      Select the macro you want the button to run when the user clicks it and click "OK." If you haven't created the code for the macro yet, you can type in a name for the macro and click "New." The VBA console will open up and you can enter in the code for the macro between the "Sub" and "End Sub" lines in the console.

    • 6

      Click the "Design Mode" button on the ribbon and right-click the button. The mouse pointer will change to a "+" sign and you can click and drag the button to another location. Click the "Design Mode" button again to lock the button in place.

    • 7

      Right-click the button and choose "Edit text" to change the text that appears on the button. Enter in whatever text you want and press "Enter."

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured