UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> GetMinArrayValue    
' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' Original submission by John White (jwhite)
' Date contributed: 2010/08/27
'NAME     : GetMinArrayValue
'PURPOSE  : Returns the Minimum value of variables passed.  Alleviates
'           the need to compare variable values with lengthy code.
'RETURNS  : Variant
'ARGUMENTS: Two or more variables or values, separated by comma's
'REFERENCE: http://msdn.microsoft.com/en-us/library/ct363x9h%28VS.80%29.aspx
'USAGE    : In VBA Code:
'           intMin = GetMinArrayValue(intScore1, intScore2, intScore3)
'           As Control Source for a Control:
'           =GetMinArrayValue([txtScore1], [txtScore2], [txtScore3])

Function GetMinArrayValue(ParamArray varValues()) As Variant
   On Error GoTo GetMinArrayValue_Error

   Dim intCounter As Integer
   GetMinArrayValue = varValues(0)
   For intCounter = 1 To UBound(varValues)
       If varValues(intCounter) < GetMinArrayValue Or IsNull(GetMinArrayValue) Then
           GetMinArrayValue = varValues(intCounter)
       End If

   Exit Function

   Resume GetMinArrayValue_Cleanup
End Function

Creative Commons License
GetMinArrayValue by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search

Thank you for your support!
This page has been accessed 5,536 times.  This page was last modified 09:35, 6 April 2011 by Jack Leach. Contributions by Alan Greenwood and jwhite  Disclaimers