NejdelÜφ hodnota v poli |
Funkce: 'Parametry FIRST a LAST indikujφ, kterß Φßst pole se zpracuje. 'Defaultn∞ je to prvnφ a poslednφ element. 'Pokud je zadßna prom∞nnß pro LONGESTINDEX, je vrßcena 'hodnota indexu nejdelÜφho elementu. Function ArrLongestItem(arr As Variant, _ Optional ByVal First As Variant, _ Optional ByVal Last As Variant, _ Optional LongestIndex As Long) As Variant Dim index As Long Dim maxLength As Long If IsMissing(First) Then First = LBound(arr) If IsMissing(Last) Then Last = UBound(arr) ArrLongestItem = arr(First) maxLength = Len(ArrLongestItem) LongestIndex = First For index = First + 1 To Last If maxLength < Len(arr(index)) Then ArrLongestItem = arr(index) maxLength = Len(ArrLongestItem) LongestIndex = index End If Next End Function |
Autor: The Bozena |