Visual Basic
J. C. Daly
Visual Basic for Applications (VBA) is integrated into Excel. It is a computer language similar to C, MATLAB, or FORTRAN.
Entering Code
-
In excel click on the Microsoft Office Button, , in the upper left corner.
Then check Excel Options.
-
The window shown below comes up.
In the Popular category, under Top options for working with Excel, select,
Show Developer tab in the Ribbon, as shown above. Click OK.
-
On the Developer tab, in the Code group, click Visual Basic.
-
In the Visual Basic Editor, on the Insert menu, click Module
-
In the code window, type the macro code. For example, the code defining a new function F(x) shown below was entered.
-
Save the workbook.
F(x) is now a function that can be evaluated by Excel, as shown below. Cell C5 contains e-x2
where x = 1. That is C5 contains, e-1 = 0.367879. More complex code is possible.