The result of a calculation may be assigned to a numeric variable or to the property of a control. A Visual Basic function performs an action and returns a value. The expressions named in parentheses are called arguments . Use the Val function to convert text values to numeric before performing any calculations. A calculation operation with more than one operator follows the order of precedence in determining the result of the calculation.
Parentheses alter the order of operations.
The formatting functions, FormatCurrency , FormatNumber , FormatPercent , and FormatDateTime , can be used specify the appearance of values for display. You can calculate a sum by adding each transaction to a module-level variable. In a similar fashion, you can calculate a count by adding to a module-level variable and calculate an average . A frequent cause of errors in Basic programming is the misspelling of variable names. You can avoid this error by including the Option Explicit statement in the General Declarations section of each module.