How to assign a macro to an option button in Excel

Support for Office 2003 has ended

Microsoft ended support for Office 2003 on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

This article was previously published under Q141689
In Microsoft Excel, you can assign a macro to a custom option button so that when the option button is selected, the macro runs.
In Microsoft Office Excel 2003, make sure that the Forms toolbar is visible. To display the Forms toolbar, point to Toolbars on the View menu, and then click Forms. You can move the Forms toolbar up next to the Standard toolbar to have it easliy accessible.

In Microsoft Office Excel 2007, to have the Option Button(form control) easily accessible, make sure that you add the Option Button (form control) to the Quick Access Toolbar. To do this, follow these steps:
  1. Click the Microsoft Office Button, and then click Excel Options.
  2. Click the Customize category, select All Commands in the Choose commands fromlist, select Option Button (form control), and then click Add.
  3. Click OK.

In Microsoft Excel 2010, to have the Option Button(format control) easily accessible, make sure you add Option Button(form control) to the Quck Access Toolbar. To do this, follow these steps:
  1. Click File and then click Options.
  2. Click the Quick Access Toolbar category, select All Commands in the Choose commands from list, select Option Button(Form Control), Click Add.
  3. Click OK.

To create an option button and to assign a macro to it, follow these steps:
  1. In Excel 2003, click Option Button on the Forms toolbar, and then draw the outline of the button on the sheet.

    In Excel 2007 and 2010, click Option Button (form control) on the Quick Access Toolbar, and then draw the outline of the button on the sheet.
  2. Select any cell in the worksheet.
  3. In versions of Excel that are for Microsoft Windows, right-click the option button, and then click Assign Macro.

    In versions of Excel that are for Macintosh, press COMMAND while you click or press CTRL while you click, depending on your operating system version. Then, click Assign Macro.
  4. In the Assign Macro dialog box, click the name of the macro that you want to assign to the option button, and then click OK.
When you click the option button, the macro will run.
 assigning XL2010 XL2003 XL2007

Article ID: 141689 - Last Review: 02/01/2012 22:04:00 - Revision: 7.0

Microsoft Office Excel 2003, Microsoft Office Excel 2007, Microsoft Excel 2010, Microsoft Excel 2008 for Mac

  • kbhowto kbprogramming KB141689