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
  • Навчання та стиль

КОМЕНТАРІ • 56

  • @EnriqueMedina-xj4mg
    @EnriqueMedina-xj4mg 8 місяців тому

    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.

  • @faizulaziz8050
    @faizulaziz8050 5 років тому +2

    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

  • @michalfomaidis4468
    @michalfomaidis4468 5 років тому +5

    Great, comprehensive explanation. Simply perfect! Thanks!

  • @mofojackson
    @mofojackson 6 років тому +1

    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! :)

  • @TheMinderEngineer
    @TheMinderEngineer 5 років тому

    Love hearing new perspectives of other entrepreneurs, keep up the hustle! 🚀

  • @darenj29
    @darenj29 7 років тому +1

    This helps a lot, Thank you... Best Regards from Panama City in Central America.

  • @MrGman127
    @MrGman127 6 років тому +2

    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).

  • @MrLinox92
    @MrLinox92 7 років тому +1

    Hi. I just wanted to tell you that your videos are really amazing.

  • @Peter1o1
    @Peter1o1 10 місяців тому +2

    Awesome video! Now everything makes sense! Now I know what every section is for! Thanks so much :)

    • @ExcelCampus
      @ExcelCampus  10 місяців тому +1

      Great to hear that, @Peter1o1 😀

  • @ivanshaw1869
    @ivanshaw1869 4 роки тому

    Excellent video. I learned so much. Thanks.

  • @horilalsoni
    @horilalsoni 3 роки тому +1

    Thanks. Its Clear and understandable easily,

  • @ajay7818
    @ajay7818 2 роки тому

    Content was super useful. Thanks!

  • @TheHughabbott
    @TheHughabbott 6 років тому

    Thanks ... really sensible explanation

  • @muhammadfathi3845
    @muhammadfathi3845 7 років тому +1

    Thank you so much, Stunning Video!!!

  • @lanejohnson5744
    @lanejohnson5744 7 років тому

    Very clearly explained. Thanks!

  • @periclesxanthippou724
    @periclesxanthippou724 Рік тому

    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.
    ΠΞ

    • @ExcelCampus
      @ExcelCampus  Рік тому

      Wow! Thank you for your feedback, Pericles! 😀

  • @masud8956
    @masud8956 5 років тому

    Great Video!

  • @GuruDanny
    @GuruDanny Рік тому +1

    Thank you for details.

  • @cindydu8644
    @cindydu8644 4 роки тому

    Thank you so much~ This gives a really wholesome intro to VBA! Cheers!

  • @masecurity4006
    @masecurity4006 7 років тому +1

    Thank you sir.

  • @dirkgosselin318
    @dirkgosselin318 Рік тому

    Great explanation! Thanks

  • @sabbathdaniel9285
    @sabbathdaniel9285 7 років тому +4

    hi, do you have continue video which tells about class module and userforms

  • @ashishtrivedi8253
    @ashishtrivedi8253 2 роки тому +2

    V early explained. Thx for the same.👍

  • @luisgustavodonascimentosil3857
    @luisgustavodonascimentosil3857 5 років тому

    amazing video. Congratulations

  • @NextIsHere
    @NextIsHere 6 років тому +1

    Very helpful

  • @Deadinside-yr7pi
    @Deadinside-yr7pi 5 років тому

    thanks ,its helpful

  • @manoharreddy6504
    @manoharreddy6504 3 роки тому +1

    Well explained

  • @anirbandas2062
    @anirbandas2062 6 років тому

    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?

  • @sandeepkothari5000
    @sandeepkothari5000 5 років тому

    Well explained. Looking forward to your tutorials on class module code and user form code.

  • @gurjar5708
    @gurjar5708 Рік тому +1

    ❤❤ thanks jon

  • @frartenzo
    @frartenzo 4 місяці тому

    thanks jon!

  • @ebrahimmahyoub6993
    @ebrahimmahyoub6993 Рік тому +1

    THANKS

  • @VBATutorialCode
    @VBATutorialCode 6 років тому

    good quality

  • @juancena2057
    @juancena2057 6 років тому

    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

  • @ApacheGamingUK
    @ApacheGamingUK 5 років тому

    Hi, where is part two of this video? I was wanting to learn about Class Modules.

  • @rogerh2694
    @rogerh2694 4 роки тому

    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?

  • @PeggywongPeggy
    @PeggywongPeggy 4 роки тому

    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

  • @Kanapita
    @Kanapita 4 роки тому +1

    thanks.

  • @KM-co5mx
    @KM-co5mx 2 роки тому

    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!

  • @aranyamajumdar9007
    @aranyamajumdar9007 7 років тому

    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 ?

  • @SivaKumar-el1hl
    @SivaKumar-el1hl 4 роки тому +1

    thanks

  • @shruthig.rshruthi6541
    @shruthig.rshruthi6541 6 років тому

    Sir please upload debugging techniques in excel VBA

  • @dimamedvedev4124
    @dimamedvedev4124 Рік тому

    Could anyone help me, why F8 doesn't work to run a macro?

  • @rohitjaddar4065
    @rohitjaddar4065 2 роки тому

    in my excel 2007 tha module is not working how to solve

  • @avb6programminguser776
    @avb6programminguser776 5 років тому

    Applies to VBA programming and VB6 programming

  • @maxmustermann853
    @maxmustermann853 3 роки тому

    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?

  • @musicworldtoday178
    @musicworldtoday178 4 роки тому

    How can i select rom of column

  • @relax_music668
    @relax_music668 3 роки тому

    how vsto write vba module ?

  • @masoomali14
    @masoomali14 4 роки тому

    How to call module from VBA Sheet