Sunday, November 25, 2012

What is VBA?

Visual Basic for Application

VBA, which stands for Visual Basic for Applications, is a programming language developed by Microsoft. It is a famous integrated development method employed by the application developers to manipulate the application using Visual Basic as the programming language. It is the place where we can create functions to perform actions other than default and as well as default functions. Almost all common Microsoft products like Excel, Word, PowerPoint, etc have this facility. VBA is a powerful way to control the applications. It allows interacting with other application like receiving and sending instructions, information’s and data.
You're probably aware that people use Excel for thousands of different tasks. Here are just a few examples:
·                   Storing data, such as employee & student information, financial & technical data, etc
·                   Organizing information
·                   Report generation
·                   Creating invoices and other forms
·                   Developing charts from table.
·                   Analyzing technical data
The list could go on and on, but you get the idea. Excel is used for a wide variety of things, and everyone reading this article has different needs and expectations regarding Excel. One thing virtually every reader has in common is the need to automate some aspect of Excel. That is what VBA is all about.
Here are some brief descriptions of some common uses for VBA macros. One or two of these may push your button.

Inserting a text string

If you often need to enter your company name into worksheets, you can create a macro to do the typing for you. You can extend this concept as far as you like. For example, you might develop a macro that automatically types a list of all salespeople who work for your company.

Automating a task you perform frequently

Assume you're a sales manager and need to prepare a month-end sales report to keep your boss happy. If the task is straightforward, you can develop a VBA program to do it for you. Your boss will be impressed by the consistently high quality of your reports, and you'll be promoted to a new job for which you are highly unqualified.

Automating repetitive operations

If you need to perform the same action on, say, 12 different Excel workbooks, you can record a macro while you perform the task on the first workbook and then let the macro repeat your action on the other workbooks. The nice thing about this is that Excel never complains about being bored. Excel's macro recorder is similar to recording sound on a tape recorder. But it doesn't require a microphone.

Creating a custom command

Do you often issue the same sequence of Excel menu commands? If so, save yourself a few seconds by developing a macro that combines these commands into a single custom command, which you can execute with a single keystroke or button click.

Creating a custom toolbar button

You can customize the Excel toolbar with your own buttons that execute the macros you write. 

Creating a custom menu command

You can also customize Excel's menus with your own commands that execute macros you write. 

Creating a simplified front end

In almost any office, you can find lots of people who don't really understand how to use computers. (Sound familiar?) Using VBA, you can make it easy for these inexperienced users to perform some useful work. For example, you can set up a foolproof data-entry template so you don't have to waste your time doing mundane work.

Developing new worksheet functions

Although Excel includes numerous built-in functions (such as SUM, COUNT, AVERAGE, PROPER, etc ), you can create custom worksheet functions that can greatly simplify your formulas. You'll be surprised by how easy this is. Even better, the Insert Function dialog box displays your custom functions, making them appear built in. Very loud stuff.

Creating complete, macro-driven applications

If you're willing to spend some time, you can use VBA to create large-scale applications complete with custom dialog boxes, onscreen help, and lots of other things.

Creating custom add-ins for Excel

You're probably familiar with some of the add-ins that ship with Excel. For example, the Analysis ToolPak is a popular add-in. You can use VBA to develop your own special-purpose add-ins.

Excel Anatomy Part04 - Home and Insert Ribbons

Home and Insert Ribbons Home Ribbon Home tab contains the most frequently used options such as cut-copy-paste, font formatting, alignme...