How To Create Vba Code Modules In Excel
Вставка
- Опубліковано 19 січ 2017
- Sign up for our Excel webinar, times added weekly: www.excelcampus.com/blueprint...
In this video I explain the different places to store macros, functions & VBA code in a workbook. We specifically look at the Code Module, Sheet Module, and ThisWorkbook Module to learn the differences between how each works.
Code Modules allow us to store regular macros (sub procedures) and functions (User Defined Functions, UDFs). This is the typical place we start writing and storing our macros. The macro recorder also creates code in a code module.
Each sheet in the workbook has a sheet object in the VB Editor. These are listed in the Microsoft Excel Objects folder for each open workbook in the Project Window. Double-clicking a sheet object opens its code module. Here we store regular macros & functions.
We can also Event Procedures that will run when the user takes an action in the worksheet. This could be actions like selecting a cell, activating a sheet, or deleting a sheet. There are a lot of events for the sheet object.
Each workbook contains one object called ThisWorkbook. The ThisWorkbook object is stored at the bottom of the Microsoft Excel Objects folder.
The main purpose of the ThisWorkbook module is to run event procedures (macros) when the user takes an action in the workbook. This could be when the user opens the workbook, before they close the workbook, when they select a worksheet, range, or even update a pivot table.
Checkout the full article and download the example file at: www.excelcampus.com/vba/code-...
Checkout my other Macros & VBA videos: • Excel Macros & VBA
Register for my free training webinar on macros & VBA:
www.excelcampus.com/vba-webinar - Навчання та стиль
Thank you very much. Not having used VBA in Excel for many years, I had forgotten the logic of where to put my code depending on what functionality I wanted. Your accurate, to-the-point description helped me refresh my memory and not waste as much time looking around for solutions to my basic (no pun intended) errors.
I am new and trying to learn VBA. This video helped me a lot to clear my understanding of different modules in VBA. Effectively explained the difference, in Code Module, Sheet Module, and This Workbook Module.Thanks
Great, comprehensive explanation. Simply perfect! Thanks!
Jon you're awesome! I am very new to actual 'coding' in excel via VBA / Macros etc. I was really lost about where to place codes and this has been a huge help! Thanks buddy! It's already starting to make way more sense now! :)
Love hearing new perspectives of other entrepreneurs, keep up the hustle! 🚀
This helps a lot, Thank you... Best Regards from Panama City in Central America.
Although, I am already enrolled in multiple excel training courses. None of the instructors
bring the clarity that you provide to the subject matter. Thanks for the tutorial. I'm in for the webinar(s).
Hi. I just wanted to tell you that your videos are really amazing.
Awesome video! Now everything makes sense! Now I know what every section is for! Thanks so much :)
Great to hear that, @Peter1o1 😀
Excellent video. I learned so much. Thanks.
Thanks. Its Clear and understandable easily,
Content was super useful. Thanks!
Thanks ... really sensible explanation
Thank you so much, Stunning Video!!!
Thank you Muhammad! :-)
Very clearly explained. Thanks!
Thank you Lane! :-)
2023-03-22 2017Z
Outstanding, Jon; thank you. A beautifully clear presentation, both in enunciation and in video quality.
I don't mean to sound xenophobic but I wish every-one that made such material for the Internet would watch -- and learn from -- your work.
ΠΞ
Wow! Thank you for your feedback, Pericles! 😀
Great Video!
Thank you for details.
Thank you so much~ This gives a really wholesome intro to VBA! Cheers!
Thank you sir.
Great explanation! Thanks
hi, do you have continue video which tells about class module and userforms
V early explained. Thx for the same.👍
amazing video. Congratulations
Very helpful
thanks ,its helpful
Well explained
Hi, this is a great video. I have a question. If I have a code in a Module macro, and want to call it from a Sheet Macro (when an event is made), Can that be made possible?
Well explained. Looking forward to your tutorials on class module code and user form code.
❤❤ thanks jon
thanks jon!
Welcome! 😀
THANKS
good quality
Hi Jon.
I have a question. It is possible to attach a SqLite database in an Excel file, and then use it, but it is inside the file in such a way that it is not visible to the users, maybe it is part of the xml file that is created when the Ribbon is customized of a File in Excel
Hi, where is part two of this video? I was wanting to learn about Class Modules.
When you select "change", that is also a cell selection change event? By default when you choose "worksheet", you're given an event procedure that runs on cell selection so is this correct?
Hi Jon, yesterday I have run one module index and match, if I want to hide the formula. how am i going to use this VBA
thanks.
Question please... What if you added a Button (Insert/Shapes...) with an assigned Module Macro to it.
Can you create a Worksheet event for when the user clicks (left-clicks) the button?
I can't find a way to do this... Thanks!
I want to change multiple numbers/dates in a cell in a userform in excel vba by a spin button. How can it be possible ?
thanks
Sir please upload debugging techniques in excel VBA
Could anyone help me, why F8 doesn't work to run a macro?
in my excel 2007 tha module is not working how to solve
Applies to VBA programming and VB6 programming
Hello guys, I'm just a beginner in vba programming, so i have following question: I want to perform a mathematical calculation in 2 different ways, which are programmed in 2 different modules. When I call up the first function (module 1) on my excel sheet, everything works fine. When I call up the second function (module 2), value 0 is displayed in the cell. I know, that the code in the second module is correct. Does anyone have an idea?
How can i select rom of column
how vsto write vba module ?
How to call module from VBA Sheet