* Operator

Description

Used to multiply two numbers.

Syntax

result = number1*number2

The * operator syntax has these parts:

Part Description
result Any numeric variable.
number1 Any numeric expression.
number2 Any numeric expression.


Remarks

The data type of result is usually the same as that of the most precise expression. The order of precision, from least to most precise, is Byte, Integer, Long, Single, Currency, Double. The following are exceptions to this order:

  • When multiplication involves a Single and a Long, the data type of result is converted to a Double.
  • When the data type of result is a Long, Single, or Date variant that overflows its legal range, result is converted to a Variant containing a Double.
  • When the data type of result is a Byte variant that overflows its legal range, result is converted to an Integer variant.
  • When the data type of result is an Integer variant that overflows its legal range, result is converted to a Long variant.

Note The order of precision used by multiplication is not the same as the order of precision used by addition and subtraction.

If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.

See Also

Operator Precedence.

Example

This example uses the * operator to multiply two numbers.


MyValue = 2 * 2                ' Returns 4.= 459.35 * 334.90     ' Returns 153836.315.