Werte aus Listbox ermitteln

Hallo, ich habe Dir 3 Funktionen geschrieben.
Probier´s mal aus.
Code:
Private Sub Command1_Click()

  MsgBox Min(List1)

  MsgBox Max(List1)

  MsgBox Mittelwert(List1)

End Sub

Private Function Min(List As ListBox) As Double
  Dim N As Long

  Min = CDbl(List.List(0))

  For N = 1 To List.ListCount - 2
    If CDbl(List.List(N)) < Min Then Min = CDbl(List.List(N))
  Next

End Function

Private Function Max(List As ListBox) As Double
  Dim N As Long

  For N = 0 To List.ListCount - 1
    If CDbl(List.List(N)) > Max Then Max = CDbl(List.List(N))
  Next

End Function

Private Function Mittelwert(List As ListBox) As Double
  Dim N As Long
  Dim Wert As Double

  For N = 0 To List.ListCount - 1
    Wert = Wert + CDbl(List.List(N))
  Next

  Mittelwert = Wert / List.ListCount

End Function
 
Zuletzt bearbeitet:
Zurück