Used to find the difference between two numbers or to indicate the negative value of a numeric expression.
result = number1 – number2 |
–number |
The - operator syntax has these parts:
Part | Description |
result | Required; any numeric variable. |
number | Required; any numeric expression. |
number1 | Required; any numeric expression. |
number2 | Required; any numeric expression. |
In Syntax 1, the – operator is the arithmetic subtraction operator used to
find the difference between two numbers.
In Syntax 2, the – operator is used as the unary negation operator to indicate
the negative value of an expression.
The data type of result is usually the same as that of the most precise expression.
The order of precision, from least to most precise, is Byte,
Integer, Long, Single, Double.
The following are exceptions to this order:
If | Then result is |
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. |
Subtraction involves a Date and any other data type, | a Date. |
One or both expressions are Null or Empty expressions, result is 0.
The order of precision used by addition and subtraction is not the same as the
order of precision used by multiplication.
Dim MyResult, Var1 |
See Also |
Operators |