12.15 Debugging: F8, Breakpoints, Immediate and Locals Windows
| Tool | How | Use |
|---|---|---|
| Step Into | F8 | Run one line at a time; the yellow line is the next to run |
| Breakpoint | click the grey margin or F9 | Run (F5) until that line, then pause |
| Run to cursor | Ctrl + F8 | Run until the cursor line |
| Hover | point at a variable while paused | See its value |
| Immediate window | Ctrl + G | Debug.Print output; type ?r or ?Cells(r,3).Value while paused |
| Locals window | View › Locals Window | All variables and their current values |
| Watch | right-click a variable › Add Watch | Break when a value changes or becomes True |
| Compile | Debug › Compile VBAProject | Finds syntax and undeclared-variable errors before running |
| Reset | the square Stop button | Stop a paused macro |
About this data: Teaching sample for a fictional shop “Skyline Clinics”. Figures and names (e.g. Sana Sheikh) are made up for this lesson on debugging f8 breakpoints immediate and locals.
Worked example. CombineCitySheets copies one row too few. Raja sets a breakpoint on destRow = destRow + (lastRow - 1), presses F5, then F8 through two sheets while watching lastRow and destRow in the Locals window – and finds the header row was counted twice in his modified version.
Ravindra Bagale's Tip
When a macro goes wrong, many students sit reading the code and guessing. Instead, run it one line at a time with F8 and watch the variables in the Locals window – you'll see immediately where it went wrong. Before running, do Debug › Compile; spelling mistakes are caught right there.
Ravindra Bagale's Tip – मराठी
Macro चुकला की बरेच students code वाचत बसून अंदाज लावतात. त्यापेक्षा F8 ने एक एक line चालवा आणि Locals window मध्ये variables बघा – चूक कुठे झाली ते लगेच दिसतं. Run करण्याआधी Debug › Compile करा; spelling च्या चुका तिथेच सापडतात.
Ravindra Bagale's Tip – हिंदी
Macro गलत चले तो बहुत से students code पढ़ते हुए अंदाज़े लगाते रहते हैं. उसकी जगह F8 से एक-एक line चलाओ और Locals window में variables देखो – गलती कहाँ हुई, तुरंत दिख जाता है. Run करने से पहले Debug › Compile करो; spelling की गलतियाँ वहीं पकड़ी जाती हैं.
Worked example — debugging f8 breakpoints immediate and locals
Why
Aarti Kulkarni in Pune and Liam Murphy abroad both need a clear, repeatable way to use debugging f8 breakpoints immediate and locals on a Summit Schools sheet without breaking totals.
What
Debugging F8 Breakpoints Immediate And Locals is the Excel idea this page teaches. We will walk one tiny example end to end.
How
- Open a blank sheet. In A1 type a short label for debugging f8 breakpoints immediate and locals.
- Enter a small made-up value for Aarti Kulkarni using £ where money appears.
- Add a second value for Liam Murphy using ₹ so you see mixed currencies stay numeric.
- Apply the method from this lesson step by step (menu or formula as shown above).
- Check the result still works inside SUM or a simple check cell.
Formula / action
Follow the formula or ribbon steps shown in this lesson (keep values numeric).
Meaning: Once debugging f8 breakpoints immediate and locals is correct on one row, copy the same pattern down the column.
Practice tasks (10+)
Try these on a blank sheet. Open a hint only if you are stuck. No quiz — just practice.
1. Rebuild the smallest example of debugging f8 breakpoints immediate and locals on a blank sheet for Skyline Clinics.
Hint: Use only the steps on this page. Keep numbers numeric.
2. Change one input for Meera Joshi and confirm the result updates.
Hint: If the result is stuck, check absolute vs relative references.
3. Repeat the same steps with a £ or € value for James O'Neill.
Hint: Formatting must not break SUM.
4. Write the result meaning in one plain sentence next to the cell.
Hint: Imagine explaining it to a new joiners.
5. Add a second row and fill the method down.
Hint: Double-click the fill handle if the pattern is consistent.
6. Break the example on purpose, then fix it using this lesson.
Hint: Common break: text instead of a number.
7. Apply debugging f8 breakpoints immediate and locals to a 5-row made-up Skyline Clinics table.
Hint: Keep column headers clear.
8. Check your answer with a simple total or COUNT.
Hint: A wrong total usually means a format or key mismatch.
9. Swap ₹ and $ on one column and re-check totals.
Hint: Stored values stay the same; only the display changes.
10. List two mistakes beginners make with debugging f8 breakpoints immediate and locals.
Hint: Look back at the tip box on this page.
11. Teach the steps out loud in under one minute.
Hint: Why → What → How.
12. Save the sheet as SkylineClin_practice.xlsx.
Hint: Use a clear file name for class.
Loading practice tasks...
- Last used row (Easy): Which row number is the last filled row? The headings are in row 1.
- Late orders (Easy): How many rows have Status "Late"?
- Total amount (Easy): Add up the Amount column.
- Worst delay (Easy): What is the largest number in the Days late column?
- Late orders in Pune (Medium): How many orders are Late and in City "Pune"?
- Customer for an order (Medium): Find the Customer for Order ID "DL-704".
- Money stuck in late orders (Medium): Add up the Amount column for rows where Status is "Late".
- Big orders (Medium): How many rows have an Amount of 2000 or more?
- Message text (Medium): Build the text "N late orders", where N is the count of Late rows.
- Average delay of late orders (Hard): What is the average Days late for rows with Status "Late"? Round to 1 decimal.
- Tag for the first row (Hard): For the first row, return "Chase" if Days late is 3 or more, else "OK".
- Warning or all clear (Hard): Return "Warning" if any order is 3 or more days late, else "All clear".
Quick revision cards
Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.


