Assigning Macros to Buttons

On an Excel worksheet it is possible to place not only graphic objects but buttons.

These objects or buttons can have macros assigned to them so that when you click the object or button some macro will be carried out.

To place a button on a worksheet the Button Tool is needed. macro4

To make this button available you need to carry out the following steps

From the Menu select

View Toolbars Forms

This toolbar has the Button tool on it.

Exercise - Building Buttons

Click on the Button Tool from the Forms Tool Bar.

Now define an area on the worksheet to be the size and place of the button.

Do this by dragging an area out with the mouse.

Release the mouse and a button will be placed on the worksheet and the Assign Macro dialog box will be displayed.

Excel assumes that you wish to assign a macro to the button so it displays the dialog box.

(If you did not wish to assign a macro to the button then just click cancel.)

Click on the macro MyName and click OK.

Click on the worksheet to deselect the button.

Now when you move the mouse over the button the pointer will change to a hand indicating that you can perform some function with this button.

Select an empty cell in the worksheet.

Click the new button.

The macro should be performed on the selected cell and your name should be displayed.