The Code section of the Developer tab contains functions that let you create Excel applications or automate repetitive tasks using Macros. This section is broken into the following functions.
Visual Basic for Applications or VBA for short, is a programming language that can be used to create applications utilizing Excel. When you click the Visual Basic button you will be taken to a code editor for your VBA application (Figure 2).
Macros allow you to capture a repetitive procedure and ‘play’ it back in Excel. Recording a macro will capture each task you complete within your spreadsheet. When you want to perform that set of tasks throughout the workbook, you can play back your Macro.
The Developer tab has several buttons related to Macros including the Macros, Record Macro, Use Relative References and Macro Security buttons.
The Macros button will give you a listing of all Macros that exist in your workbook. From here you can type in a name for a Macro and click the Create button to create a new Macro (Figure 3). Note that creating a Macro this way will lead you right into the VBA editor.
If you wish to have Excel record your actions as you perform them, use the Record Macro button. Give your Macro a name, description and shortcut key and click OK. The Record Macro button will now change to one that says ‘Stop Recording’. Perform your tasks and click the Stop button to save your Macro.
In order to use Macros you will need to enable them by clicking on the Macro Security button and then clicking ‘Enable all macros’ (Figure 4). Be aware that Macros obtained through spreadsheets of unknown origin could contain malicious code that could harm your computer. Be wary of using spreadsheets from unknown sources with this option turned on.