Check out your first recorded macro
Now let’s watch your very first Excel macro being recorded. This is a great way for you to understand the ins and out of how Excel actually works. And when you see how a macro is recorded with your own eyes, it will be a lot simpler and more logical for you to create your own codes in the future. Everything will make a lo more sense when you are able to see how Excel understands and prepares the codes for macros, so that they can be used again in the future.
Most professional developers will tell you, though, that Excel tends to make things a lot more complicated than they should be when it records things on its own. This is a software after all, so it relies on pre-programmed codes to help it as much as possible. When you create these codes on your own, they will not need to be as complex and as long as Excel tends to make them.
Start by opening the Excel coding sheet side by side to your Excel worksheet. Now, let’s make Excel record something simple such as aligning numbers in a column. To do this, in the column A, write a list of numbers one after the other. For example, you can write the numbers 1 to 10. Then, click on the Record Macro button in your developer toolbar at the very top. You will see a new dialogue box open. In this dialogue box, you will need to give your macro a name, and from the list of selections under “Store macro in”, make sure that you choose Personal Macro Workbook. This way, you will ensure that all of your created macros are safely stored in the same place and that you will not have any security issues in the future. Click OK when you’re done. Excel is now recording your macro.
Now, go back to the cells that you wish to align in the worksheet. Select all the numbers 1 to 10, click on the alignment that you wish to make, and when the numbers are properly aligned, go up to the toolbar and click “Stop Recording”. In the coding window, you will now see a new item appear, usually with the title “Personal”, in which your new recorded macro has been placed. You can click on this and then expand it to see how the macro code looks.
You have now completed the recording and saving of your very first macro! If you are someone who is just starting out on this journey, you can continue to create and record macros this way for as long as you like. It will be especially useful if you already know the steps that you take more frequently when you are working in a particular Excel worksheet.