Sunday, February 15, 2015

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 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 module called Module1. You can also place the code on the any of the Sheets, in this case the macro will be available for particular sheet only. 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

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. When executed the macro will stop at this line.


No comments:

Post a Comment