Excel VBA Macro Programming
You can add a breakpoint into your code so that your code will halt at that line. You can then use step commands to move through one line at a time and use instant watch to examine variables as the code steps through.
Breakpoints can be toggled on and off by using F9 or by selecting Debug Toggle Breakpoint from the menu. They appear as a solid brown circle in the leftmost column of the code window.
If you run the preceding loop example and place a breakpoint on the Loop statement, you will see that every time you click the Run symbol or F5 , it stops on the Loop statement.
You can step through the program one line at a time by clicking F8 or by using Debug Step Into ( F8 ) from the code menu. Other options allow you to Step Over ( Shift-F8 ), Step Out (run program normally), or Run to Cursor (run code down to where the cursor is). While you are stepping through a program, you can still use your cursor to examine values.
You can also open a Debug window to watch expressions and see what they are doing.