Microsoft Office Tutorials and References
In Depth Information Stepping into Stepping into
Step Into executes code one statement (or instruction) at a time. If the statement being executed
calls another procedure, stepping into that statement simply transfers control to the first line in the
called procedure. For instance, with reference to the previous code, stepping into the line:
Call ProcedureB
in ProcedureA transfers control to the first line of ProcedureB :
ActiveSheet.Cells(1, 1).Font.Size = 24
Further tracing proceeds in ProcedureB . Once all of the lines of ProcedureB have been traced,
control returns to ProcedureA at the line immediately following the call to ProcedureB —that
is, at the line:
ActiveSheet.Cells(1, 1).Font.Bold = True
Step Into has another important use. If we choose Step Into while still in design mode, that is,
before any code is running, execution begins but break mode is entered before the first line of
code is actually executed. This is the proper way to begin tracing a program. Step Over (Shift-F8 or choose Step Over from the Debug menu)
Step Over is similar to Step Into, except that if the current statement is a call to another procedure,
the entire called procedure is executed without stopping (rather than tracing through the called
procedure). Thus, for instance, stepping over the line:
Call ProcedureB
in the previous procedure executes ProcedureB and stops at the next line:
ActiveSheet.Cells(1, 1).Font.Bold = True
in ProcedureA . This is useful if we are certain that ProcedureB is not the cause of our
problem and we don't want to trace through that procedure line by line. Step Out (Ctrl-Shift-F8 or choose Step Out from the Debug menu)
Step Out is intended to be used within a called procedure (such as ProcedureB ). Step Out
executes the remaining lines of the called procedure and returns to the calling procedure (such as
ProcedureA ). This is useful if we are in the middle of a called procedure and decide that we
don't need to trace any more of that procedure, but want to return to the calling procedure. (If you
trace into a called procedure by mistake, just do a Step Out to return to the calling procedure.) Run To Cursor (Ctrl-F8 or choose Run To Cursor from the Debug menu)
If the Visual Basic Editor is in break mode, we may want to execute several lines of code at one
time. This can be done using the Run To Cursor feature. Simply place the cursor on the statement
immediately following the last line you want to execute and then execute Run To Cursor. Set Next Statement (Ctrl-F9 or choose Set Next Statement from the Debug
Search JabSto ::

Custom Search