Code:
Public Function MaxValOfIntArray(ByRef TheArray As Variant) As Integer 'This function gives max value of int array without sorting an array Dim i As Integer Dim MaxIntegersIndex As Integer MaxIntegersIndex = 0 For i = 1 To UBound(TheArray) If TheArray(i) > TheArray(MaxIntegersIndex) Then MaxIntegersIndex = i End If Next 'index of max value is MaxValOfIntArray MaxValOfIntArray = TheArray(MaxIntegersIndex) End Function
Comment