Subscriber only lesson.
Sign up to this course to view this lesson.
About this lesson
How to set and use breakpoints during code development and debugging.
Download this lesson’s exercise file.Using Breakpoints.xlsm
Introduction to Breakpoints.
When to use
To allow stopping execution at key points when running code. (This is faster for debugging than stepping through each line of code you know is working correctly.)
Inserting a Breakpoint
- Click in the left-hand margin next to the line of code where you want the Breakpoint to be inserted.
- The line of code will be highlighted in red and a red dot will appear to the left.
Running Code with a Breakpoint
- When running a macro with a Breakpoint the code will stop on the line where the Breakpoint is located (without executing it)
- When you hit a Breakpoint, you may then continue by either stepping or clicking Run
- Click on the red dot to manually to remove the Breakpoint.
- You can insert multiple Breakpoints into your code.
- While the code is at a Breakpoint, you can work back and forth between Excel and VBA
- Breakpoints cannot be saved in your code. Reopening the project will cause all Breakpoints to be reset.
Lesson notes are only available for subscribers.