Subscriber only lesson.
Sign up to this course to view this lesson.
About this lesson
How to use the Watch window to break code execution when variable conditions are met.
Download this lesson’s exercise file.Using the Watch window.xlsm
Using the Watch window
Using the Watch window for debugging.
When to use
To allow breaking code execution when variables hit certain limits, or just monitoring a variable's value during stepping.
Opening the Watch Window
- Go to the View menu on the main toolbar and select Watch window.
Adding a Watch
- Right click in the Watch window and select Add Watch.
- Type the expression for what you want to look for in the Expression field.
- Select your Watch Type option.
- Allows the code to run and will display the information gathered by the Watch expression in the Watch window.
Break When Value Is True
- Will stop the code running when the value of the Watch expression becomes true.
Break When Value Changes
- Will stop the code running any time the value of the Watch expression changes.
Hints & tips
- You can create multiple Watches for the same subroutine.
- You can edit a watch expression by right clicking on the Watch and selecting Edit Watch.
Lesson notes are only available for subscribers.