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

Fix Up Variant To Range Sub
Fix Ups Class

Public Sub FixUpVariantToRange( _
      ByRef rValue As Variant _
    , ByVal vMin As Variant _
    , ByVal VMAX As Variant _
    )

Fix up the argument rValue so that it is within the range from vMin to vMax.
rValue will be left unchanged if it is within the range,
it will be set to vMin if it is less than vMin,
or it will be set to vMax if it is greater than vMax.

Example:
    Assuming
       Dim intNum As Integer
       intNum = 20
    for example
       FixUpVariantToRange intNum, 30, 40
    leaves
       intNum = 30
Example:
    Assuming
       Dim strName As String
       strName = "Word"
    for example
       FixUpVariantToRange strName, "Alpha", "India"
    leaves
       strName = "India"
See also:
    RangeComp Function
    IsBetween Function
Summary:
    Value < Min: Let Value = Min
    Value > Max: Let Value = Max
    Min <= Value <= Max: Do nothing.
rValue: The value which is modified if it is not between vMin and vMax inclusive. This argument is set to vMin if less than vMin or vMax if greater than vMax.
Note: rValue is a pass-by-reference argument, so the value of the variable passed via this argument may be modified within the calling function.
vMin: The lower-bound of the range of acceptable values. rValue will be set to vMin if it is less than vMin.
vMax: The upper-bound of the range of acceptable values. rValue will be set to vMax if it is greater than vMax.
Note: This function performs Binary comparisons when the arguments are strings.

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