30.04.2017 Views

4523756273

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 13: Bug Extermination Techniques<br />

203<br />

✓ Move the cursor to the statement at which you want execution to stop;<br />

then press F9.<br />

✓ Click in the gray margin to the left of the statement at which you want<br />

execution to stop.<br />

✓ Position the insertion point in the statement at which you want execution<br />

to stop. Then use the Debug➪Toggle Breakpoint command.<br />

✓ Right-click a statement and choose Toggle➪Breakpoint from the shortcut<br />

menu.<br />

The results of setting a breakpoint are shown in Figure 13-5. Excel highlights<br />

the line to remind you that you set a breakpoint there; it also inserts a large<br />

dot in the gray margin.<br />

Figure 13-5:<br />

The highlighted<br />

statement<br />

marks a<br />

breakpoint<br />

in this<br />

procedure.<br />

When you execute the procedure, Excel goes into Break mode before the<br />

line with the breakpoint is executed. In Break mode, the word [break] is displayed<br />

in the VBE title bar. To get out of Break mode and continue execution,<br />

press F5 or click the Run Sub/UserForm button in the VBE toolbar. See “stepping<br />

through your code” later in this chapter to find out more.<br />

To quickly remove a breakpoint, click the large dot in the gray margin or move<br />

the cursor to the highlighted line and press F9. To remove all breakpoints in<br />

the module, press Ctrl+Shift+F9.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!