The easiest way to skyrocket your YouTube subscribers
Get Free YouTube Subscribers, Views and Likes

Master VBA Debugging in 20 Minutes

Follow
Excel Macro Mastery

Ready to master VBA?
Check out my full courses: https://courses.excelmacromastery.com/
Subscribe to the channel here: https://bit.ly/36hpTCY
Want to download the source code for this video? Go here: https://shorturl.at/Ncam5
(Note: If the download page doesn't work then make sure to turn off any popup blockers)

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 realworld example
* Plus loads of cool tips and tricks you didn't know

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 RealWorld Example

posted by den191q