How to edit and debug the macro created in Excel VBA ?

There are two ways to view the already recorded macro.

1. You can click on Macros from the Developer tab (if you are not able to see the developer tab, you need to enable it from options menu) and then click on Edit. The Visual Basic Editor will appear.
2. You can directly open the Visual Basic Editor by clicking on Visual Basic from the Developer tab (or press Alt+F11).

The created macros are placed into a modules, which can be renamed as per your requirements, the default name is Module1, Module2 and so on.
You can also place the code on any of the Sheets, in this case the macro will be available only for particular sheet. While the macro created in the module is available for all the sheets in the workbook.
To manually run the code step by step, press F8. pressing F8 on keyboard, will run each line at once and move to next step. This will help you to check if your written code does not have any error.
To run the code till particular step, you need to break the code for this, put your cursor on the line where you need to put break and press F9.
Once you press F9, the line color will be changed to brown selection. In case you have a long code and you made few changes in middle of that code. The F9 feature can save your time to test that particular line of codes.
When you press F9 the line color is changed, which means it acts as a pause of the macro at that step. So when you run this macro, the execution will stop where you had presses F9.
Thank you for reading. Happy Learning !

Please leave a reply if you like the article or if you need any help on excel

%d bloggers like this: