MENU

Fun & Interesting

3 Laws of Readable VBA Code

Excel Macro Mastery 7,556 lượt xem 2 weeks ago
Video Not Working? Fix It Now

👉 Want to write real-world VBA code?
- Check out my course: https://bit.ly/3XTnIm8

👉 Looking for the source code for this video?
- Download it here:https://shorturl.at/OPlhp

- Subscribe to the channel here: https://bit.ly/36hpTCY

Struggling to keep your VBA code clean and easy to understand? This video will help you write code that’s more readable, more maintainable, and far easier to debug.

You'll learn 3 simple habits that will:

🔹 Make your code self-explanatory — even weeks or months after you wrote it
🔹 Cut down on repetitive and error-prone patterns
🔹 Keep related logic grouped together for faster navigation and fewer headaches

These small changes can make a huge difference, especially in large or long-term VBA projects. If you've ever opened an old workbook and asked yourself “What was I thinking?” — this video is for you.

💻🔧 #VBALaws #VBAReadableCode #ExcelVBALaws #ExcelVBAReadableCode

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 in the 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)

Comment