For more information about writing macros, see Microsoft Visual Basic Help (Microsoft Visual Basic Help: To get help for Visual Basic in Excel, point to Macro on the Toolsmenu, and then click Visual Basic Editor. On the Help menu, click Microsoft Visual Basic Help.).
- Display the Control Toolbox: point to Toolbars on the View menu, and then click Control Toolbox.
- Click Design Mode
.
- Right-click the control, and then click View Code on the shortcut menu.
- In the Visual Basic Editor, write a new macro or change the existing macro.
- When you finish writing the macro, click Close and Return to Microsoft Excel on the File menu.
- When you finish designing the control, click Exit Design Mode
.
Tip
If you're designing a form for use on a Web page rather than in Microsoft Excel or a Visual Basic program, use a Web script (script: A type of computer code used to perform tasks on Web pages, such as incrementing a "number of visitors" counter each time there is a new visitor. Web scripts can be written in several script languages. Scripts do not need to be compiled to be run.) instead of a macro to automate the control.