Quote Originally Posted by HanneSThEGreaT
32768 is the maximum size for an Integer. Why not make the arrintArray() parameter in your GetArrayMinxMax function, a long. Like this :
Code:
Public Function GetArrayMinxMax(arrintArray() As Long,
intArrayUpperBound As Long) As String
That's all I can advise based on what you gave.

And pretty please with sugar on top, use Tags when posting code.
Right idea, but it looks like the function attempts to determine the maximum and minimum values in the array. As far as I can tell, the data type of the array shouldn't be relevant -- it's the data type of the loop counter that needs to change.

I'm also not quite sure what the function is for, as it doesn't return a value or alter a ByRef passed variable. I'd do something like this:
Code:
Public Sub GetArrayMinxMax(iArray() As Integer, ByRef iMax As Integer, ByRef iMin As Integer)
        
    Dim lCount As Long
    
    iMax = 0                                                    'Initialize the maximum.
    For lCount = LBound(iArray) To UBound(iArray)               'Loop through the array.
        If iArray(lCount) > iMax Then iMax = iArray(lCount)     'Check against cached max.
    Next lCount

    iMin = iMax                                                 'The min has to be lower.
    For lCount = LBound(iArray) To UBound(iArray)               'Second pass.
        If iArray(lCount) < iMin Then iMin = iArray(lCount)     'Check against cached min.
    Next lCount

End Sub
Note that this also prevents errors if called with a non-zero based array and eliminates the need to pass a bounding variable. In this case 2 passes through the array also ensures correct returns if the minimum value is higher than 5000. Also, passing the return variables ByRef lets you return both the minimum and maximum without using string handling functions. If you want it to work with arbitrarily signed numbers, set iMax to -32768 instead of 0.

Example calling code:
Code:
Private Sub CallingIE()

    Dim iTest() As Integer, iMax As Integer, iMin As Integer
    
    ReDim iTest(100)                                'Build a test array.
    For iMax = 0 To 100
        iTest(iMax) = Rnd * 10000
    Next iMax

    Call GetArrayMinxMax(iTest, iMax, iMin)         'Call the function.
        
    Debug.Print iMax & vbTab & iMin

End Sub