You can create a macro with Excel commands by recording the key strokes and mouse clicks, giving the macro a name and specifying how to store the macro. A macro thus recorded can be run with an Excel command.
Suppose you have to collect certain results repeatedly in the following format –
Instead of creating the table each time, you can have a macro to do it for you.
Recording a Macro
To record a macro do the following –
• Click the VIEW tab on the Ribbon.
• Click Macros in the Macros group.
• Select Record Macro from the dropdown list.
The Record Macro dialog box appears.
• Type MyFirstMacro in the Macro name box.
• Type A Simple Macro in the Description box and click OK.
Remember that whatever key strokes and mouse clicks you do, will be recorded now.
• Click in the cell B2.
• Create the table.
• Click in a different cell in the worksheet.
• Click the VIEW tab on the Ribbon.
• Click Macros.
• Select Stop Recording from the dropdown list.
Your macro recording is completed.
The first step to click on a particular cell is important as it tells where exactly the macro has to start placing the recorded steps. Once you are done with the recording, you have to click Stop Recording to avoid recording of unnecessary steps.
No comments:
Post a Comment