höchsten werte
31.10.2019 21:51:09
Thomas
ich kann mit dem untenstehenden Makro den höchsten Wert einer listbox markieren.
Nun möchte ich gern die 5 höchsten Werte in der Listbox ( in der Spalte 1 ) markieren.
Wobei die 5 variabel bleiben soll.
Kann mir dabei jemand helfen? Ich bekomme das einfach nicht hin.
Habt schon mal rechtvielen dank für euer Interesse.
mfg Thomas
Dim spaltemark
Dim i As Long
Dim MerkerWert
Dim listArr() As Double
ReDim listArr(0 To neueform1.ListBox2.ListCount - 1)
For i = 0 To neueform1.ListBox2.ListCount - 1
listArr(i) = neueform1.ListBox2.List(i)
Next
'MsgBox Application.Max(listArr)
MerkerWert = Application.Max(listArr)
'MsgBox wertausbox1
'#####################################
For spaltemark = 0 To neueform1.ListBox2.ListCount - 1
If neueform1.ListBox2.List(spaltemark, 0) = MerkerWert Then
neueform1.ListBox2.Selected(spaltemark) = True
End If
Next spaltemark