• Kalpesh Agrawal

How to add VBA to the Excel and common terms of VBA

Welcome to the KalpTalk.

If you are unable to see the VBA icon in your Excel workbook on your desktop screen, you can add it by following the steps given below.

If you are going to learn the Excel VBA first time, possibly there is a VBA icon that is not available on your Excel Menu bar.

Follow the steps given below to add the VBA icon to your Excel Menu bar...

  • VBA is located in the DEVELOPER tab, you can see that in ribbon but if you were not able to see then follow the below steps…

  • First, go to the File tab, and then select Options from the drop-down menu. When Excel Options windows appear, click on the Customize Ribbon option on the left. Click on the Developer checkbox under the list of Main tabs on the right. Then click the OK button.

  • Now, you can see the ribbon like this.

You can see many options in the Developer tab, all are related to the Visual Basics.

Let’s know the common terms and user-interface of the VBA screen.

1. Menu Bar: You are very well familiar with this. That contains File, Edit, View, etc. tabs.

2. Tool Bar: There are some commands given there, when we go ahead you will get familiar with that.

3. Project Explorer: It is very important to learn all the common terms. This is Project Explorer which has all the elements or the objects means that contain all the sheets, workbooks, modules, and class. One other important thing is that, 3(I) has the name “VBAProject (VBA_Learning.xlsm)”, means the excel file in which I am currently working is saved as “VBA_Learning.xlsm”.

If you add the worksheets in Excel, it automatically added to the VBA project explorer.

If you are working on two excel workbooks, VBA shows both the workbooks in Project Explorer, like if I open one more new workbook by pressing CTRL+N, it automatically adds to the Project explorer dialogue box.

There are two more important things UserForm and Module, So let’s understand how to add these.

User form is a very important feature in Excel VBA, you can make a form, calculator, survey form, etc. using user form.

You can assign the code to every part you created in the user form.

On the other side, Module helps you to write the code, and you can run that code directly in the Excel sheet.

3(II) is the User form that is an object. When you click on it, it will open a dialogue box as below.

When you open a user form, it will be given the name “UserForm1” by default.

There are so many tasks, you can do with UserForm, but before that learn all the basics of the Excel VBA.

3(III), is Module…This is a very much important part because whatever coding will be writing, will be writing in the module part…Let’s see how it looks like.

So, every time you open a new module and write code you can run it in the current Excel sheet or the particular sheet assigned in the code.

Editor Pane is the part of the screen where you will write the code, and that is just one area of the screen you can see in the above image where you can write the code.

4. Properties: This dialogue box shows the properties of the object or sheet you have been selected. Properties show the Name, EnableAutoFilter etc.

Ok, so you understand most of the terms now there are two more things you have to understand in VBA.

**Immediate Window: You can open this window by simply pressing CTRL+G, or directly click on the View tab and then open from there.

The immediate window looks like the image, given below.

Now, the question is what is the use of Immediate Window? So you can type the question in the immediate window and you will get the answer. You will learn more details about this in another article on Immediate Window.

**Project Browser: You can see all the objects there and the methods you will be able to work.

You can open the Project Browser, by clicking on “Object Browser” OR by directly press F2.

There are different classes of the objects, after a click on the particular class you can find what things you can do, what are the methods you can do like you can add, count, create, item, and so on.

So, you know how to open VBA, now we will go through the basic functions of VBA.

After completing this you will have the idea of how to write code in the VBA and how to execute the code.


Thanks for reading, you can read further topics in the next articles.


Related Posts

See All