Microsoft Office Tutorials and References
In Depth Information
Recording Your First Macro
Follow these steps to start recording an action:
1. Enter the name in the Macro Name field.
For this example, type AddDataBars .
2. Select This Workbook in the Store Macro In option (see Figure 13-3).
3. Click OK.
Figure 13-3: Start recording a new Macro called AddDataBars.
Excel is now recording your actions.
While Excel is recording, you can perform any actions you want. The following example records a
macro to add data bars to a column of numbers.
1. Highlight cells C1:C21.
2. Go to the Home tab and select Conditional Formatting➜New Rule.
The New Formatting Rule dialog box opens.
3. In the New Formatting Rule dialog box, go to the Format Style drop-down menu and select
The New Formatting Rule dialog box now shows a new set of options related to Data Bars.
4. Place a check in the Show Bar Only check box.
5. Click OK to apply your change.
6. Go to the Develop tab and click the Stop Recording command.
At this point, Excel stops recording. You now have a macro that replaces the data in C1:C21 with
Now, record a new macro to remove the data bars:
1. Go to the Developer tab and click the Record Macro command.
2. Enter RemoveDataBars in the Macro Name field and select This Workbook in the Store
Macro In option (see Figure 13-4). Click OK.