Microsoft Office Tutorials and References
In Depth Information
4.6.1.6 Breaking out of Debug mode
We can also change the flow of execution while in break mode by placing the cursor on the
statement that we want to execute next and selecting Set Next Statement. This will set the selected
statement as the next statement to execute, but will not execute it until we continue tracing.
4.6.1.6 Breaking out of Debug mode
When we no longer need to trace our code, we have two choices. To return to design mode, we
can choose Reset from the Run menu (there is no hotkey for this). To have Excel finish executing
the current program, we can hit F5 or choose Run from the Run menu.
4.6.2 Watching Expressions
It is often useful to watch the values of certain expressions or variables as we trace through a
program. Excel provides several ways to do this.
4.6.2.1 Quick Watch (Shift-F9)
This feature is used to quickly check the value of a variable or expression while in break mode.
We just place the insertion point over the variable name and hit Shift-F9 (or choose Quick Watch
from the Debug menu). For instance, Figure 4-9 s hows the Quick Watch dialog box when the
expression x + 2 is selected in the code in Figure 4-10 . According to Figure 4-9 , at the time that
Quick Watch was invoked, the expression x + 2 had the value 8. Note that if we had just placed
the insertion point in front of the letter x , then Quick Watch would have reported the value of this
variable alone.
Figure 4-9. The Quick Watch window
Another way to quickly get values for expressions or variables is to enable Auto Data Tips on the
Editor tab of Excel VBA's Options dialog box. With this feature enabled, when we place the
mouse pointer over a variable or select an expression and place the mouse pointer over it, after a
slight delay, a small yellow window will appear containing the value of the variable or expression.
This is very useful!
4.6.2.2 The Locals and Watches windows
There are two special windows that aid in watching expressions: the Watches window and the
Locals window. These are shown in Figure 4-10 .
Figure 4-10. The Locals and Watches windows
 
 
Search JabSto ::




Custom Search