VBA in Excel: What is VBA, How to use

VBA in Excel

VBA stands for Visual Basic Application. It is an event-driven programming language used by Microsoft for its applications. VBA helps in many way ways like creating an automation process of any activity that we do manually, creating user-defined functions, or any activity which is repetitive in nature. By using VBA in excel we can save time and resources.

How to use VBA in Excel

We can use it in two different ways either by using VBA editor or by recording Macro. The choice depends on the expertise and comfort level of the user.

Where is VBA in excel

To use VBA editor we need to open VBA editor either by pressing alt & F11 or go to the Developer tab option and then Visual Basic. A new screen will open like the below image.

VBA in Excel
VBA

Now we will go to Project -VBAProject window which is on left upper side then right click on VBAProject(Book1) then go to Insert then Module.

Excel VBA
VBA IDE

Now we will get a new screen on right side to write our code.

Macro2
VBA in exel

To use a macro recorder we need to go to Developer tab option and then Code section as shown in the below image. In the code section click on Record Macro and then record your steps.

VBA component
VBA component

A new screen option will come for naming the macro, providing short key if any, where to store macro and description. After providing details click OK .

Record Macro
Record Macro

Now start recording your steps. After finishing your steps Stop Recording option to complete it.

Stop Macro
Stop Macro

We can check our codes in VBA editor by clicking alt & F11.

To use these recording in future we just need click Macros in Developer tab. A pop up will come with all macros available. Choose your macro name and then click Run. Then see the magic.

Run Macro
Run Macro

That’s all for now for Excel VBA. We catch up again with something new for learning.

Leave a Comment

Scroll to Top