When preparing papers and spreadsheets, adding or updating data, or developing forms that other people can fill out, a macro helps to increase productivity.
The two most often used programs for data entry and storage are Microsoft Word and Excel.
Using the Visual Basic programming language or by recording actions, macros may be made in Word and Excel.
Follow the instructions below to build a macro in Microsoft Word or Microsoft Excel.
Create macro in Microsoft Word
Choose whether you want to construct a macro manually or by recording actions, then follow the instructions to do so in Microsoft Word.
Create macro manually using Visual Basic
- Click the View tab in the navigation bar of Microsoft Word.
- Select Macros from the menu.
- In the Macro Name text box of the Macros window, provide a name for the new macro.
- Select Create from the menu.
- The Microsoft Visual Basic for Applications software launches, allowing you to manually enter Visual Basic code to construct a macro.
- Close the Visual Basic application after generating the macro by clicking the Save symbol in the menu bar.
Create macro by recording actions
- Click the View tab in the navigation bar of Microsoft Word.
- Select the Record Macro option by clicking the arrow next to the Macros option.
- Give the new macro a name in the Macro name text box of the Record Macro window.
- To designate a key combination to execute the macro, click the keyboard icon.
- Press the key combination you wish to use to launch the macro in Microsoft Word after clicking the Press a new shortcut key box in the Customize Keyboard window.
- Click the Close button once you have clicked the Assign button in the bottom left corner.
- Immediately after hitting the Close button, macro recording begins.
After completing the tasks you wish to record, run the macro.
Text may be typed, formatted, created into a table, and added with shapes or pictures. - When you have finished all of the tasks you wanted to include in the macro, click the arrow under Macros on the View tab and then select Stop Recording.
Create a Macro in Microsoft Excel
Choose whether you want to construct a macro manually or by recording activities, then follow the instructions to do so in Microsoft Excel.
Create macro manually using Visual Basic
- Click the View tab in the navigation bar of Microsoft Excel.
- Select Macros from the menu.
- In the Macro Name text box of the Macros window, provide a name for the new macro.
- Select Create from the menu.
- The Microsoft Visual Basic for Applications software launches, allowing you to manually enter Visual Basic code to construct a macro.
- Close the Visual Basic application after generating the macro by clicking the Save symbol in the menu bar.
Create macro by recording actions
- Click the View tab in the navigation bar of Microsoft Excel.
- Select the Record Macro option by clicking the arrow next to the Macros option.
- Give the new macro a name in the Macro name text box of the Record Macro window.
- To designate a key combination to execute the macro, click the keyboard icon.
- Select the key combination you wish to use to launch the macro in Microsoft Excel by clicking the Press a new shortcut key box in the Customize Keyboard window.
- Click the Close button once you have clicked the Assign button in the bottom left corner.
- Immediately after hitting the Close button, macro recording begins.
After completing the tasks you wish to record, run the macro.
You may enter data, format it, turn it into a graph or chart, add formulae, and perform other operations on it. - When you have finished all of the tasks you wanted to include in the macro, click the arrow under Macros on the View tab and then select Stop Recording.