If you have tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes. After you create a macro, you can edit it to make minor changes to the way it works.
Suppose that every month, you create a report for your accounting manager. You want to format the names of the customers with overdue accounts in red, and also apply bold formatting. You can create and then run a macro that quickly applies these formatting changes to the cells you select.
How?
Before you record a macro
Make sure the Developer tab is visible on the ribbon. By default, the Developer tab is not visible, so do the following:
Record a macro
Take a closer look at the macro and experiment
You can learn a little about the Visual Basic programming language by editing a macro that you have recorded.
To edit a macro, in the Code group on the Developer tab, click Macros, select the name of the macro that you recorded, and click Edit. This starts the Visual Basic Editor.
Take a look at the code, and see how the actions that you recorded appear as code. Some of the code will probably be clear to you, and some of it may be a little mysterious.
Experiment with the code, close the Visual Basic Editor, and run your macro again. This time, see if anything different happens!
Suppose that every month, you create a report for your accounting manager. You want to format the names of the customers with overdue accounts in red, and also apply bold formatting. You can create and then run a macro that quickly applies these formatting changes to the cells you select.
How?
Before you record a macro
Make sure the Developer tab is visible on the ribbon. By default, the Developer tab is not visible, so do the following:
- Click the File tab, click Options and then click the Customize Ribbon category.
- Under Customize the Ribbon, in the Main Tabs list, click Developer, and then click OK.
Record a macro
- In the Code group on the Developer tab, click Record Macro, and then click OK to start recording.
- ..contd...
- Perform some actions in your worksheet, such as typing some text, selecting some columns or rows, or filling down some data.
- In the Code group on the Developer tab, click Stop Recording.
Take a closer look at the macro and experiment
You can learn a little about the Visual Basic programming language by editing a macro that you have recorded.
To edit a macro, in the Code group on the Developer tab, click Macros, select the name of the macro that you recorded, and click Edit. This starts the Visual Basic Editor.
Take a look at the code, and see how the actions that you recorded appear as code. Some of the code will probably be clear to you, and some of it may be a little mysterious.
Experiment with the code, close the Visual Basic Editor, and run your macro again. This time, see if anything different happens!


No comments:
Post a Comment