Public Sub TimesEqual( _
ByRef rLeft As Variant _
, ByVal vRight As Variant _
"Times Equals" or "Assign Multiplication" 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.
Multiply rLeft by vRight and assign the result back into rLeft.
Similar to the C language "*=" operator.
Dim dblValue As Double
dblValue = 2.5
TimesEqual dblValue, 2
dblValue = 5See also:
MinusEqual SubroutineDefinition (Visual Basic):
rLeft = rLeft * vRightDefinition (C):
rLeft *= vRight;rLeft: Numeric or date value which is multiplied by vRight. The result of the multiplication 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 by which rLeft is multiplied.
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.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.