Sam: Sortieralgorithmus

Beitrag lesen

Hier mein 2. Versuch (alles in einer sub, nicht mehr drei separate hintereinander)

Public Sub faechersort(ByRef arrSort)
  dim i, j, arrTemp
  for i = 0 to ubound(arrSort)
    for j = i + 1 to ubound(arrSort)
      if ((arrSort(j)<>"" and not isnull(arrSort(j))) and _
        (arrSort(i) > arrSort(j) and  _
        not (arrSort(i)="PH" or arrSort(i)="L" or arrSort(i)="M" or arrSort(i)="MU" or arrSort(i)="BK" or arrSort(i)="IN"))) _
        or (arrSort(j)="PH" or arrSort(j)="L" or arrSort(j)="M" or arrSort(j)="MU" or arrSort(j)="BK" or arrSort(j)="IN") then
          arrTemp = arrSort(i)
          arrSort(i) = arrSort(j)
          arrSort(j) = arrTemp
        end if
    next
  next
End Sub

Hier fehlt nun aber die Unterscheidung zwischen den Gruppen (PH,L) und (M,MU,BK,IN) - letztere Werte haben ja gegenüber den erstgenannten Priorität ....

Grüße,
Sam