\ Operator

Used to divide two numbers and return an integer result.

Syntax

result = operand1 \ operand2

Remarks

The operands can be any numeric expression.

Before division is performed, the operands are rounded to Integer or Long expressions.

Usually, the data type of result is an Integer, a Long, or a Variant of VarType 2 (Integer) or VarType 3 (Long) regardless of whether or not result is a whole number.  Any fractional portion is truncated.  However, if any operand is a Null, result is also a Null.  Any operand that is Empty (VarType 0) is treated as 0.

Arithmetic Operators

Comparison Operators

Concatenation Operators

Logical Operators

Operator Precedence

Other Operators

VarType Function

\ Operator Example

The example divides 100,000 by 7 using integer division and returns 14,285.  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