Signature (Visual Basic / VBA)
Public Sub MinusEqual( _
ByRef rLeft As Variant _
, ByVal vRight As Variant _
)
Code Examples
Assuming
Dim dblValue As Double
dblValue = 2.5
for example
MinusEqual dblValue, 2
leaves
dblValue = .5
rLeft = rLeft - vRight
rLeft -= vRight;
Parameters
| Parameter | Description |
|---|---|
| rLeft | Numeric or date value from which vRight is subtracted. The result of the subtraction is assigned back into the variable passed via rLeft, unless that value happens to be passed-by-value (in which case, calling this function has no effect). |
| vRight | The numeric value that is subtracted from rLeft. |
Notes & Version History
| Summary | This function is usually faster than the macroized eqivalent ("rLeft = rLeft - vRight") if rLeft is not a simple variable. This is because rLeft is passed-by-reference so that Visual Basic must only evaluate its address once. |
| Note | We would NOT use this subroutine to replace something like "dblValue = dblValue - 2", but we WOULD use it to replace something like "adblMatrix(intColumn, intRow, intItem) = adblMatrix(intColumn, intRow, intItem) - 2", especially since we only have to mention the "adblMatrix(intColumn, intRow, intItem)" part once. |