Table of contents
TOC
Collapse the table of content
Expand the table of content

* Operator

office 365 dev account|Last Updated: 1/23/2018
|
2 Contributors

Used to multiply two numbers. Syntaxresult=number1 * number2 The \* operator syntax has these parts:

PartDescription
resultRequired; any numeric variable.
number1Required; any numeric expression.
number2Required; any numeric expression.

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

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

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

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

Example

This example uses the \* operator to multiply two numbers.

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

© 2018 Microsoft