MENU

Fun & Interesting

How VBA Objects Really Work in Memory

Excel Macro Mastery 57,224 5 years ago
Video Not Working? Fix It Now

👉 Ready to master VBA? - Check out my full courses: https://courses.excelmacromastery.com/ - Subscribe to the channel here: https://bit.ly/36hpTCY - FREE CHEAT SHEET: Get the free cheat sheet on VBA arrays here: https://bit.ly/2MXsnz9 (Note: If the download page doesn't work then make sure to turn off any popup blockers) How VBA Objects Really Work in Memory You may have used object variables in VBA. For example when you use a Collection you are using an object variable. Most people don't realise that the actual object is not stored in the variable. It is the address of the object. This is done seamlessly in VBA so most of the time we don't need to worry. However when we are passing objects into subs\functions, adding them to arrays\Collections\Dictionaries then it is important to understand how VBA Objects really work in memory. #vbaobjects #vbaobjectsmemory Related article: The Complete Guide to Excel VBA Objects(https://excelmacromastery.com/vba-objects/) Useful VBA Shortcut Keys: View the Immediate Window: Ctrl + G View the Watch Window: Alt + V + H Tab: To move lines of code to the right(Indent). Shift + Tab: To move lines of code to the left(Outdent). Shift + F2: Get the definition of the item under the cursor. Ctrl + Shift + F2: Go to the last cursor position. Ctrl + Space: AutoComplete Word. Alt + F11: Switch between Excel and the VBA Editor. Ctrl + G: view the Immediate Window Ctrl + R: View the Project Explorer Window. Ctrl + Shift + 8(or Ctrl + *): Get the current region on a worksheet. F4: View the Properties Window. F5: Run the code from the current sub. F8: Step into the code. F9(or click left margin): Add a breakpoint to pause the code. Table of Contents: 00:00 - Introduction 00:15 - Basic Variables 01:56 - Let and Set 03:10 - VBA Objects 05:10 - Using Set and New 06:44 - Set New Example 13:04 - Setting one object to another 16:43 - VBA Objects Recap 16:44 - Conclusion

Comment