390 likes | 700 Views
Excel Functions. Part 1. Introduction. An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the Excel spreadsheet. For example, the sum of two variables can be evaluated in an Excel spreadsheet as follows :.
E N D
An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the Excel spreadsheet.
For example, the sum of two variables can be evaluated in an Excel spreadsheet as follows:
This same sum can be done in the environment of Visual Basic (VB)
You can define a function called "Sum", which receives the value of two inputs "x" and "y" and returns the value of the sum of them
If the tab is not available, see Note 1 "Activate tab" at the end of the document. - Click on the "Programmer" tab
Function code The codes are written in the VB "Modules"
Function code The codes are written in the VB "Modules" To open a module
Function code The codes are written in the VB "Modules" To open a module Click right button on the left side window
Function code The codes are written in the VB "Modules" To open a module Click right button on the left side window It opens a window
Appears the new created VB module, with the name Module1. This name can be changed later by a more suitable one.
The right window displays a flashing line The module is now ready for use
Código de la función Suma In the right window type the function name followed by the dependent variables.
Código de la función Suma In the right window type the function name followed by the dependent variables Function Suma(x,y)
Código de la función Suma In the right window type the function name followed by the dependent variables. Function Suma(x,y) When you "Enter", VB automatically puts the final line of the function.
Sum Function Code In the right window type the function name followed by the dependent variables. Function Suma(x,y) End Function
The new code must be written between these two commands. In this case, the code consists of a single line
The new code must be written between these two commands. In this case, the code consists of a single line Suma = x + y