When you set a breakpoint in a custom function, and then type a formula
that refers to that function, Microsoft Excel displays the Visual Basic
Editor in break mode. You can then step through the macro code by pressing
F8, or you can press F5 to continue running the code. You can also set
watches and perform other tasks.
In Visual Basic for Applications, follow these steps to set a
breakpoint in a custom function or subroutine:
- Move the insertion point to line of code where you want to set the
breakpoint.
- Press F9, or click Toggle Breakpoint on the Debug menu.
The line of code turns a maroon color and a maroon colored dot appears to
the left of the code.
NOTE: You can also remove a breakpoint by following the same steps.
When you use a Microsoft Office program that contains an embedded
Microsoft Excel workbook, and you type or edit a formula that refers
to a custom function containing a breakpoint, Microsoft Excel and
the Microsoft Office program may stop responding. Microsoft recommends
that you do not set a breakpoint in a custom function when you are working
in Microsoft Office Binder or your workbook is embedded in another
Microsoft Office program.