For those just diving into the world of Excel macros, crafting a simple macro is the key to better understanding. It helps beginners grasp the basics and encourages them to explore advanced macro functionalities in Excel. If you want to learn how to create, save, and run macros in Excel, refer to the example shared in this article.

In this article, we provide guidance on various ways to create and use Macros, saving Macros in Excel. Join us as we explore these techniques.
Firstly, if the Developer tab is not visible in your Excel file, follow these steps to display it on the Ribbon toolbar:
1. Select File -> Options.

2. In the Excel Options window, choose Customize Ribbons, then check the box next to Developer and press OK.

Method 1: Creating Macro using Record Macro
Step 1: In your Excel file, select the cell for your actions, then choose Developer -> Record Macro.

Step 2: A Record Macro dialog appears; you enter a name for your macro in the Macro name section (without spaces or accents). You can also describe your macro in the Description section. Optionally, set a shortcut key in the Shortcut key field. Then, press OK to start recording actions on Excel.

Step 3: Start performing the actions you want to include in your macro, such as alignment adjustments like centering, bolding text, applying colors, and background shading.

Step 4: After completing your actions and wanting to stop recording the macro, select Developer -> Stop Recording.

This completes the creation of a simple Macro. If you want to create additional Macros, repeat the same process.
Step 5: Apply the created macro.
Choose a cell in Excel where you want to use the macro, then select Developer -> Macros.

In the Macro dialog, pick the desired macro name and click Run to execute the macro.

Immediately, the selected data cell will undergo the actions defined in the macro during its creation.

Method 2: Creating Macro using Visual Basic code
Step 1: Choose Developer -> Macros or press the shortcut Alt + F8.

Step 2: In the Macro dialog, enter a name for your macro in the Macro name section (no spaces, no accents) and click Create.

Step 3: In the Sub tenmacro()......End Sub section, write Visual Basic code. If you're not familiar with coding, find suitable code online, copy, and paste it between Sub.... End Sub. Then close the Visual Basic window.
Example: Here's a simple code snippet that helps you italicize and highlight text in red.

Step 4: Use Macro
You can use the macro similarly to the method mentioned earlier. Select the cell where you want to run the macro and click Developer -> Macros.

In the Macro dialog, choose the desired macro name and click Run.

So the macro will run and execute exactly as the Visual Basic code you entered.

Step 5: Set up a shortcut to use the macro.
If you haven't set a shortcut during macro creation, you can do so by selecting the macro name in the Macro dialog and clicking Options.

In the Macro Options dialog, enter a character next to Ctrl and press OK to save the shortcut.
Note: You can only input characters, not numeric keys.

So instead of having to choose Macros -> Macro name -> Run, you can directly use the shortcut you've just set to execute the macro.
Step 6: Save Macro
Select File -> Save As (or press F12). In the Save As window, choose the file location, set the file name. In the Save as type section, select Excel Macro-Enabled Workbook, and click Save to save the Excel file with the macro.

Now you know how to create and use macros in Excel, as well as how to save them. To learn how to enable, disable, or delete macros in Excel, you can refer to the article on How to Enable, Disable, or Delete Macros in Excel.
Mastering the use of macros in Excel will significantly speed up your Excel tasks, saving you valuable time. Wishing you success in your Excel endeavors!