Excel has a feature called Macro Recorder. This tool tracks the actions performed in the spreadsheets and transforms them into VBA code. It's a great way to understand how things work.
Access the Macro Recorder feature in the Developer tab $\rightarrow$ Record Macro.
For learning purposes, it is recommended that you place the Excel and VBE worksheet windows side-by-side when using the Macro Recorder feature. In this way, you can follow every step of the code creation.
Try to record a macro now!
Note that when using the Macro Recorder feature, a module is automatically created in the VBE Project Explorer.
Avoid unnecessary errors and actions while recording a macro because everything is being recorded and encoded.
Stay alert and do not be alarmed because the Macro Recorder feature generates a lot of unnecessary code.
The Macro Recorder feature can also be accessed quickly by the shortcut located in the lower left corner of Excel.
One way to access recorded macros is through the Macro Window.
The are a few ways to open the Macro window:
One way to access the code created by the recorder is by clicking Edit.
If the Use Relative References option is turned off at the time the macro is being written, when you run the macro it will perform ("literally") the same actions in the same cells.
Usually the aim of creating and writing macros is to generate a code that can be used in a wide, relative way. Therefore, it is advisable to leave this option enabled.
If you created a macro and when saving your work the warning below pops-up:
Click "No", so you do not lose the macro you created.
Whenever you create macros in an Excel file be sure to save it in a macro-enabled extension (.xlsm ), otherwise all created code will be lost.
SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.
Excel ® is a registered trademark of the Microsoft Corporation.
© 2023 SuperExcelVBA | ABOUT