Master VBA Debugging in 20 Minutes
Excel Macro Mastery Excel Macro Mastery
82.5K subscribers
32,994 views
0

 Published On Mar 8, 2022

Master VBA Debugging in 20 Minutes

In this video, I'm going to cover everything you need to know about Debugging in VBA.
* What is debugging and why you need it.
* When to use the Locals window and when to use the Watch Window.
* The SandBox Method
* Putting it all together - a real-world example
* Plus loads of cool tips and tricks you didn't know

SUBSCRIBE TO THE CHANNEL: https://bit.ly/36hpTCY

DOWNLOAD THE SOURCE CODE FOR THIS VIDEO: https://bit.ly/3hNWnM4

Related Training
The Excel VBA Handbook Course(https://TheExcelVBAHandbook.com)
Webinar Archives - 60+ Hours of VBA training(https://excelmacromastery.com/excel-v...)

Free Excel VBA Resources
Excel VBA Articles (https://excelmacromastery.com/vba-art...)

Useful VBA Shortcut Keys
========================

Debugging:
Compile the code: Alt + D + L OR Alt + D + Enter
Run the code from the current sub: F5
Step into the code line by line: F8
Add a breakpoint to pause the code: F9(or click left margin)

Windows:
View the Immediate Window: Ctrl + G
View the Watch Window: Alt + V + H
View the Properties Window: F4
Switch between Excel and the VBA Editor: Alt + F11
View the Project Explorer Window: Ctrl + R

Writing Code:
Search keyword under cursor: Ctrl + F3
Search the word last searched for: F3
Autocomplete word: Ctrl + Space
Get the definition of the item under the cursor: Shift + F2
Go to the last cursor position: Ctrl + Shift + F2
Get the current region on a worksheet: Ctrl + Shift + 8(or Ctrl + *)
To move lines of code to the right(Indent): Tab
To move lines of code to the left(Outdent): Shift + Tab
Delete a Line: Ctrl + Y(note: this clears the clipboard)

Table of Contents:

00:00 - Introduction
00:40 - What is Debugging?
01:19 - Simple Debug Example
01:50 - The Debug Toolbar
02:25 - The Locals Window
03:58 - The Watch Window
05:03 - Watch Window: Using Functions
06:20 - Tips for Debugging Ranges
07:33 - Watch Window: Divide Conquer
08:45 - Step Into/Over/Out
11:31 - Run to Cursor
11:59 - Set Next Statement
12:48 - The Call Stack
13:45 - Show Next Statement
14:17 - Break in a loop
15:43 - The Sandbox Method
17:27 - Real-World Example

show more

Share/Embed