\ operator
Used to divide two numbers and return an integer result.
Syntax
result = number1 \ number2
The \
operator syntax has these parts:
Part | Description |
---|---|
result | Required; any numeric variable. |
number1 | Required; any numeric expression. |
number2 | Required; any numeric expression. |
Remarks
Before division is performed, the numeric expressions are rounded to Byte, Integer, or Long expressions.
Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Long variant, regardless of whether result is a whole number.
Any fractional portion is truncated. However, if any expression is Null, result is Null. Any expression that is Empty is treated as 0.
Example
This example uses the \
operator to perform integer division.
Dim MyValue
MyValue = 11 \ 4 ' Returns 2.
MyValue = 9 \ 3 ' Returns 3.
MyValue = 100 \ 3 ' Returns 33.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.