<-- Previous || Up || Next -->

Set 1st If Neg 2nd If Pos Sub
Math Reals Class

Public Sub Set1stIfNeg2ndIfPos( _
      ByVal vExpr As Variant _
    , ByRef rSetIfNeg As Variant _
    , ByRef rSetIfPos As Variant _

"Set First If Negative Or Set Second If Positive"
Subroutine assigns positive values to one of the arguments.
Subroutine assigns (Absolute value of) negative values to the other argument.

       Dim varNeg As Variant
       Dim varPos As Variant
    for example
       Set1stIfNeg2ndIsPos 45, varNeg, varPos
       varNeg = 0
       varPos = 45
       Set1stIfNeg2ndIsPos -45, varNeg, varPos
       varNeg = 45
       varPos = 0
See also:
    FixUpVariantToRange Subroutine
vExpr: The number whose absolute value is assigned to one of the two other arguments, depending upon whether this number is positive or negative. Subroutine silently does nothing if vExpr is Null or cannot be fixed up to a number.
rSetIfNeg: Argument which receives the absolute value of vExpr if vExpr is negative. This should be a numeric or Variant argument.
rSetIfPos: Argument which receives the value vExpr if vExpr is positive. This should be a numeric or Variant argument.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.