Apa itu Visual Basic Editor ? Visual Basic Editor atau disingkat dengan VBE adalah area tempat dimana anda menuliskan kode macro ( kode VBA ), cara mengakses VBE bisa melalui tab developper atau dengan menekan kombinasi tombol alt+f11, interface editor benar benar berbeda dan terpisah dengan lembar kerja microsoft excel dan setiap aplikasi office seperti worl, power point dan lain-lain mempunyai jendela editor ini
Saya akan mengulas sedikit dasar dasar dari jendela editor ini
Project window
This window will show you all the files that you have opened. The Project Window uses a tree view where you can drill down into each file that you have open and see the areas in which you can insert VBA code. Notice that in my screenshot under that there are two files that are open in my Excel application: Book1 (a workbook) and VBHTMLMaker (an add-in). In Book1 you can see 3 subfolders
3 sub folder itu adalah Microsoft object, module dan form. tiga sub folder ini mempunyai fungsi masing masing yang saling terkait satu dengan yang lain
Properties window
Properties window adalah jendela untuk mengcustom form dan module, salah satu hal yang paling penting adalah bagian
Code Writing Area
This is where the magic happens! In this area you can actually write and edit your VBA code. Each macro must begin with a Sub statement (which is opened with Sub [insert your macro name] ( ) and closed with End Sub). Notice also that the VBA Editor color-codes some key words in a few different colors. This helps make your code more organized. I have two major tips that I like to share with people when they are first learning to write VBA code:
Immediate Window
I like to refer to this area as my piece of scratch paper. The Immediate window lets you do all sorts of tests while writing and running your code. You can use the code Debug.Print to tell VBA to send the information that follows to the Immediate window. This could be the output value of a function, the value of a cell, or what a current application property is set to. When I first began writing VBA code I had no idea the Immediate window ever existed (it's usually hidden by default but you can use the shortcut Ctrl + g to view it), but once learned everything it could do I never stopped incorporating it's functionality into my code writing and testing processes.
Watch Window
The Watch Window is kind of like an X-ray machine. It will show you all the data that is stored inside a variable! Some variables (like the ones you create in your code) will not have very much data stored in them. However, if you were to "watch" a variable that was assigned to a cell, you would see a whole bunch of data (font color, value, height, fill color, etc...). This is mostly usefully when you are trying to debug your code and want to understand what value your variable has at any given point in your code.
In order to watch a variable you need to highlight your variables text and click the Add Watch button (this is the eyeglasses icon located on the debugging toolbar). You should then see your variable appear in the Watch Window. Once you start running through your code and load a value to your variable, you should see an option (plus sign) to drill down or expand out the contents that is now stored in the variable.