Excel VBA AI Assistant LogoExcel VBA AI Assistant
    Debugging
    VBA
    Troubleshooting
    Best Practices
    Featured

    Breakpoints, Watches & Immediate Window: Advanced Debugging in VBA

    Master breakpoints, watches, and the Immediate Window to see what your VBA code is doing in real time.

    VBA AI Team
    Published on August 17, 2025
    12 min read

    Breakpoints, Watches & Immediate Window: Advanced Debugging in VBA

    Master the VBE’s tools to see what your code is doing—live.


    Breakpoints (F9)

    Stop execution at a line to inspect state. Conditional breakpoints: right-click breakpoint → Condition.


    Watches

    Track variable expressions while stepping.

    1. Debug → Add Watch
    2. Enter expression (e.g., lastRow or Cells(r, "C").Value)
    3. Choose Break When Value Is True to pause automatically

    Immediate Window (Ctrl+G)

    Evaluate expressions and call procedures at runtime.

    ? Worksheets("Data").Range("A1").Value Call TestProcedure(42)

    Practical example

    Sub Analyze() Dim lastRow As Long, r As Long lastRow = Cells(Rows.Count, "A").End(xlUp).Row For r = 2; r <= lastRow; r = r + 1 Debug.Print r, Cells(r, "A").Value Next r End Sub

    Set a Watch on lastRow, a Breakpoint inside the loop, and print diagnostic output in Immediate.

    Work faster with the VBA Assistant

    Create, explain, and improve your VBA code with examples, comments, and best practices—directly in your workflow.