In this video I talk about VBA Debug aspects like the Immediate Window, Local Window and Watch Window.
…also we use the “debug.print” statement to print a value to the Immediate window.
The Local Window is useful to view the current state of all the variables present in the current sub procedure.
The Watch Window is useful on long running processes that you don’t want to step through line by line. In the example we want to “watch” and set a breakpoint when a variable’s value becomes 20. We don’t want to set a breakpoint and step through each time the variable changes, 100 times, so a breakpoint would be too time consuming.
Private Sub watch() Dim x As Integer Do Until x = 100 Debug.Print x x = x + 1 Loop End Sub