This is an article on creating Excel Macro using the macro recorder.We earlier covered a tutorial on creating Word Macros using Macro Recorder. It is very easy to create Excel Macro in a similar manner.Excel Macros can be created by any normal Excel user, using a macro recorder, while advanced users can even use VBA to create them. (We had already posted an article on creating a Word Macro using VBA).
Like in Word 2007, Developer tab must have been enabled in Excel 2007 to record or create Macros.If the Developer tab is not enabled,
- Click the Microsoft Office Button , and then click Excel Options.
- Click Popular category and under Top options for working with Excel, select the Show Developer tab in the Ribbon check box
- Click OK
The Developer tab will now be visible in Excel 2007.Next, set the security level to Enable all macros. To do this, navigate to Developer tab, and in the Code group, click Macro Security.Under Macro Settings, click Enable all macros (not recommended;potentially dangerous code can run) , and then click OK. However it is not recommended to enable all macros, always, as there is high risk of potentially dangerous code getting executed.Hence it is advisable to return to any one of the settings that disable all macros, after you finish working with Excel macros.
How to record or create an Excel Macro?
- On the Developer tab, in the Code group, click Record Macro.
- In the Macro name box, enter a name for the macro. Note that The first character of the macro name must be a letter. Subsequent characters can be letters, numbers, or underscore characters. Spaces cannot be used in a macro name
- To assign a CTRL combination shortcut key to run the macro, in the Shortcut key box, type any lowercase letter or uppercase letter that you want to use.But you nned to be careful in assigining shortcut keys as the shortcut key will override any equivalent default Excel shortcut key while the workbook that contains the macro is open.
- In the Store macro in list, select the workbook where you want to store the macro. If you want a macro to be available whenever you use Excel, select Personal Macro Workbook. When you select Personal Macro Workbook, Excel creates a hidden personal macro workbook (Personal.xlsb) if it does not already exist, and saves the macro in this workbook. In Microsoft Windows XP, this workbook is saved in the C:\Documents and Settings\user name\Application Data\Microsoft\Excel\XLStart folder, while in Windows Vista, this workbook is saved in the C:\Users\user name\AppData\Local\Microsoft\Excel\XLStart folder. Workbooks in the XLStart folder are opened automatically whenever Excel starts. If you want a macro in the personal macro workbook to be run automatically in another workbook, you must also save that workbook in the XLStart folder so that both workbooks are opened when Excel starts.
- In the Description box, type a description of the macro.
- Click OK to start recording and perform the actions that you want to record.
- Once the actions to be recorded are completed, click Stop Recording on the Developer tab, in the Code group.
How to delete an Excel Macro?
- Open the Excel workbook that contains the macro you want to delete.
- If the macro that you want to delete is stored in the personal macro workbook (Personal.xlsb), and this workbook is hidden, do the following to unhide the workbook:
- On the View tab, in the Window group, click Unhide.
- Under Unhide workbooks, click PERSONAL, and then click OK.
- In the Macros in list, select the workbook that contains the macro that you want to delete.
- In the Macro name box, click the name of the macro that you want to delete and Click Delete.
That is all about creating an Excel Macro using Macro Recorder and deleting any Excel Macro.