* Operator

See Also2MXRWRN              Example131TV86>Low

Used to multiply two numbers.

Syntax

result = operand1 * operand2

Remarks

The operands can be any numeric expression71RISN.

The data type3GYXY7 of result is usually the same as that of the most precise operand.  The order of precision, from least to most precise, is Integer, Long, Single, Double, Currency.  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 Variant8PHEAW3 of VarType7A68ZTZ 3 (Long), VarType 4 (Single), or VarType 7 (Date) that overflows its legal range, result is converted to a Variant of VarType 5 (Double).

         When the data type of result is a Variant of VarType 2 (Integer) that overflows its legal range, result is converted to a Variant of VarType 3 (Long).

 

If one or both operands are Null1DDW7C0 expressions, result is a Null.  Any operand that is Empty1L2JEZ4 (VarType 0) is treated as 0.


See Also

Arithmetic OperatorsSH0K1B

Comparison OperatorsNRJZ1K

Concatenation Operators2MYTW1K

Logical Operators1CQVUTN

Operator Precedence23082A9

Other Operators2HA580P

VarType FunctionXRZH1Y


* Operator Example

The example determines tax on a user-supplied value using the * operator to multiply the user-supplied value by the tax rate of 15%.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

 

Sub Form_Click ()

   Dim N As Double, Tax As Double              ' Declare variables.

   N = InputBox("Enter a number.")             ' Get tax rate.

   Tax = .15 * N                               ' Calculate tax.

   MsgBox "Tax is " & Tax                      ' Display results.

End Sub