NejvyÜÜφ hodnota pole

Funkce:
'Parametry FIRST a LAST indikujφ, kterou Φßst pole zpracovat. 
'Pokud nejsou zadßny, bere se celΘ pole. 
'Pokud je vlo₧ena prom∞nnß pro MAXINDEX,
'funkce jφ p°i°adφ hodnotu indexu nejv∞tÜφho elementu
 

Function ArrayMax(arr As Variant, Optional ByVal First As Variant, _ 
   Optional ByVal Last As Variant, _
   Optional MaxIndex As Long) As Variant 

   Dim Index As Long 

   If IsMissing(First) Then First = LBound(arr) 
   If IsMissing(Last) Then Last = UBound(arr) 

   ArrayMax = arr(First) 
   MaxIndex = First 

   For Index = First + 1 To Last 
      If ArrayMax < arr(Index) Then 
         ArrayMax = arr(Index) 
         MaxIndex = Index 
      End If 
   Next 

End Function

Zp∞t

Autor: The Bozena