# 12.15 Debugging — प्रत्येक lineचा result पाहा

Source: https://ravindrabagale.com/mr/excel/ch12-macros-and-vba/12-15-debugging-f8-breakpoints-immediate-and-locals.html
Language: mr (Marathi with English technical terms)

| Tool | Windows shortcut / menu | कशासाठी?

 | Step Into | F8 | एक line चालवा; yellow line पुढची आहे.

 | Breakpoint | Margin click / F9 | F5 run तिथे pause.

 | Run to Cursor | Ctrl + F8 | Cursor lineपर्यंत run.

 | Hover | Paused variableवर pointer | Value पाहा.

 | Immediate | Ctrl + G | Debug.Print किंवा ?r.

 | Locals | View › Locals Window | Current scopeच्या variables.

 | Watch | Right-click › Add Watch | Expression पाहा; change/Trueवर break.

 | Compile | Debug › Compile VBAProject | Syntax आणि declaration errors.

 | Reset | Stop square | Execution थांबवा.

एक row कमी copy होत असेल तर

Combine macroच्या destRow update lineवर breakpoint लावा. F5, मग F8ने दोन sheets process करा. Localsमध्ये lastRow, destRow आणि copied range पाहा. Header एकदाच धरला आहे का तपासा.

Compile errors पकडतो; चुकीचं total किंवा off-by-one business logic आपोआप पकडेलच असं नाही. Reset/End केल्यास सामान्य cleanup code चालेलच असं नाही; Application settings तपासा.

Practice

LoopExamplesच्या For loopमध्ये breakpoint. Immediateमध्ये ?r आणि ?ws.Cells(r,8).Value print करा. Next rनंतर counter आणि next target कसा बदलतो ते पाहा.

रवींद्र बागले यांची tip

Guess करत बसण्यापेक्षा एक छोटी sample file आणि F8 वापरा. प्रत्येक stepनंतर “expected value काय?” आणि “actual काय?” लिहिलं की bug लवकर सापडतो.
