|
|
|
|
VBA is the acronym for Visual Basic for Applications. It is an integration of the Microsoft's event-driven programming language Visual Basic with Microsoft Office applications such as Microsoft Excel. By running VBA within the Microsoft Office applications, you can build customized solutions and programs to enhance the capabilities of those applications.
A lot of people might not
realize that they can actually learn the fundamentals of Visual Basic
programming without having a copy of Visual Basic professional. Why? Because
there is built-in Visual Basic Editor in Microsoft Excel, and you can use it to
customize and extend capabilities of MS Excel. The applications you build with
MS Excel is called Visual Basic for Applications, or simply VBA.
You can program VBA in every
version of Microsoft Office, including MS Office 97, MS Office2000, MS
Office2002, MS Office2003 and MS Office XP. The reason VBA is needed is due to
the limitations in using the built-in functions of VB and macro recording. By
using VBA, you can build some very powerful tools in MS Excel, including
financial and scientific applications such as getting financial data from the
Internet as well as linear programming.
|
There are two ways which you
could program a VBA, one is to place a command button on the spreadsheet and
start programming by clicking the command button, another one is to write Visual
Basic functions inside the VB Editor. Lets start with the command button first.
In order to place a command button on the spreadsheet, you need to click View on
the MS Excel menu bar and then click on toolbar and finally select the Control
Toolbox after which the control toolbox bar will appear. Then you click on the
command buttton and draw it on the spreadsheet.
Next,
you click on the command button and the Visual Basic Editor will appear. Then
you enter the statement as shown in the figure. The first statement will fill up
cell A1 to cell A10 with the phrase "Visual Basic" while the second statement
add the value in cell A11 and cell B11 and then show the sum in cell C11.
It is that simple.
 |
|
|
The Output

|
|
|