Thursday, May 17, 2012

How to Make a Button for a Macro in Excel


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

Blogger news