VBA In Office Excel 2010

VBA stands for Visual Basic for Application. As you know that VB (Visual Basic) is one of the great programming languages. If you need to do repeated tasks in excel every day, then it is always recommend to automate such tasks so that you can save time and energy. Macros are a great way of automating tasks in Excel, we have already covered a basic tip on recording and using Macros. Macros basically add VB code to your excel sheet.

Whenever you create a new Macro, Excel adds visual basic code at the back-end, so whenever you run a Macro, this VB code is executed and you get the results on the screen. Lets see how the code is generated when we add a Macro and how you can edit and debug this VB code.

How To View The VBA Code Associated With A Macro

Lets assume that we have created a Macro, as mentioned in the post referenced above, then click the Macro option and choose View Macros.

The Macro’s dialogue box will be displayed, here choose the Macro for which you wish to see the VB code and hit the Edit button.

EditMacro thumb VBA In Office Excel 2010

It will open the Macro as a VB code within the VB Editor which is embedded by default in Excel. In this example, I am showing you the code of a basic macro which displays the “Hello World” message when run.

Macro Code VBA

If you know the fundamentals of Visual basic, then you can write your own code here to further improve your Macro and you can add more functionality to your created Macros by adding pieces of code. The editor displayed in Excel is a typical VB editor with The Project Explorer on the left and the source/design window on the right. All you need is familiarity with the syntax of the programming language.

How To Debug VBA Code

If you have made any changes to a Macro’s code, and you want to test to confirm if it is working fine, then you can do this by debugging and running the code. Press F5 and it will debug and execute the code and you will get the results on the screen. (My Code only contains “Hello World”, so I am able to see it on the screen after debugging and execution)

VBA Executed Please note that we have only given an example of Excel 2010, because VBA is most used here. VBA however is also included in Outlook 2010, Word 2010, PowerPoint 2010, etc.

قالب وردپرس

About Alyse Kalish

Alyse Kalish
As an Associate Editor for The SalesJobInfo, Alyse is proud to prove that yes, English majors can change the world. She calls many places home, including Illinois where she grew up and the small town of Hamilton where she attended Colgate University, but she was born to be a New Yorker. In addition to being an avid writer, Alyse loves to dance, both professionally and while waiting for the subway.

Leave a Reply

Your email address will not be published. Required fields are marked *