Open the VBA Editor

If you want to add a macro to a workbook, or if you want to create macros from scratch, you need to open the VBA Editor.

VBA is a powerful language that can perform a wide variety of tasks, but its main purpose is to operate on the application in which it is running. With Excel VBA, for example, you can create macros that add text and formulas to cells, format ranges, insert or delete worksheets, create and manipulate PivotTables, and much more.

You can store macros in any workbook, but Excel provides a special workbook for this purpose: the Personal Macro Workbook. Whichever workbook you use, Excel stores the macro code in a module, a special window in which you can view, edit, ...

Get Excel® PivotTables and PivotCharts: Your visual blueprint™ for creatingdynamic spreadsheets, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.