Macro is not only usually used in Word, but also used in MS Excel widely, because of different kinds of operations repeatedly on table data.
However, Macro is not available by default in all Excel workbooks for security. So sometimes before enabling, creating or deleting macros in excel, we need to do something first.
Part 1: Prepare to operate on Excel 2010 macros
For example, if there is no Developer tab in MS Excel 2007/2010 menu bar, it is necessary to add it to Excel menu bar first, otherwise, you could not create macros in MS excel. If there is, bypass this part and go on to part 2.
1. Click File tab, and click Options.
2. Click Customize Ribbon tab in Excel options window. In the Customize the Ribbon category, in the Main Tabs list, select Developer, and click OK.
Then you can see Developer in Excel menu bar, and Macros is in Developer tab, Code group.
Part 2: Enable, Create and Delete Macros in MS Excel 2010
If you are ready, let’s begin to enable macros, create macros and delete macros in Excel 2010.
- Section 1: How to enable Macros in MS Excel 2010
- Section 2: How to create Macros for MS Excel 2010 workbook
- Section 3: How to delete or remove Macros from Excel 2010 workbook
Section 1: How to enable Macros in MS Excel 2010
In Excel default settings, Macros is disabled in Excel 2007/2010. Therefore, if you want to do anything about Macros in workbook or worksheet, such as create Macros or delete Macros in Excel, Macros has to be enabled at first.
1. On Developer tab, in Code group, click Macro Security.
2. In following pop-up Trust Center dialog, click Macro Settings, and check Enable all macros (not recommended; potentially dangerous code can run) under Macro Settings option. Click OK.
Now Excel 2007/2010 is ready for you to create macros.
Section 2: How to create macros for MS Excel 2010 workbook
Step 1: Click Record Macro button in Developer tab.
In Developer – Code group, there is a button Record Macro. If you want to create macros in Excel 2010, it is enough for you to do with “Record Macro” button. Just click it when you think you are ready to create a macro.
Then Record Macro dialog appears, and several options have to be set in this dialog before macro creation.
Step 2: Set Macro parameters for new macros in Record Macro dialog.
1. Macro name
Macro name is the direct description about the macro you are going to create. So give it a name with actual meaning could let you easily distinguish to run it later in Excel workbook. For example, if you want to bundle steps of creating title in table into macro, you can call macro “CreateTableTitle”.
2. Shortcut key
In Excel 2010, Shortcut key is set to begin recording steps into a macro, and used to run macro after creation. So we had better set different shortcut key for different macros that macros would not be confusing, when we use shortcut key to run Macro in Excel workbook.
3. Store macro in
Macros in Excel can apply to This Workbook, New Workbook or Personal Macro Workbook. This option specifies where the macro can be used.
4. Description
In Description, anything can be set as you like. You can describe the macro more in details, or record the macro creation date etc.
Step 3: Record operation steps into macro.
After click OK in Record Macro, do what you want to record in macro. When you finish, click Stop Recording in Developer – Code group.
Macro has been created now. If you would like to see the steps in macro, click Macros in Code group. In opening Macro dialog, click the Macro you want to see details and click Edit button in the right side.
Then a new VBA window shows up. The operation steps and other information of all of Macros you just see are listed with VBA code. Even though you want to change Macro, change the VBA code now is allowable.
Section 3: How to delete or remove macros from Excel 2010 workbook
Here excel 2010 macros will be deleted in Macros dialog.
1. Click Developer tab, and click Macros in Code group. Macros dialog pops up.
2. All of Macros available to this Excel workbook are listed in Macros dialog. Click on Macros you want to delete, and click Delete button on the right side.
No matter you want to edit, run or delete Macros in Excel, the steps are similar to the above steps.
Related Articles: