/ Operator

See Also3EZ6AT              ExampleREYQX3>Low

Used to divide two numbers and return a floating-point result.

Syntax

result = operand1 / operand2

Remarks

The operands can be any numeric expression71RISN.

The data type3GYXY7 of result is usually a Double or a Variant8PHEAW3 of VarType7A68ZTZ 5 (Double).  The following are exceptions to this rule:

         When both operands are Integer or Single expressions, result is a Single unless it overflows its legal range, in which case, result is a Double.

         When both operands are Variant expressions of VarType 2 (Integer) or VarType 4 (Single), result is a Variant of VarType 4 (Single) unless it overflows its legal range, in which case, result is a Variant of VarType 5 (Double).

 

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 divides 100,000 by 7 and returns 14,285.7142857143.  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 Result As Double                        ' Declare variable.

   Result = 100000 / 7                         ' Divide numbers.

   MsgBox "100000 divided by 7 is " & Result   ' Display results.

End Sub