Ich habe VBA-Code um eine ComboBox automatisch mit Werten zu füllen und Code um die Listeneinträge zu sortieren (siehe unten).
Wie kann ich diese beiden Codes verknüpfen das die Einträge sortiert werden? Habe leider keinen Plan!
Besten Dank für jegliche Hilfe!
Gruss Reto E.
Sub KategorieFilter()
Dim wks As Worksheet
Dim liZeile As Integer
Dim liInhalt As Integer, liDoppelt As Integer, lboDoppelt As Boolean
Dim liEintrag As Integer
Set wks = Worksheets("Preisliste")
liZeile = 11
Do Until wks.Range("A" & liZeile).Value = ""
liZeile = liZeile + 1
Loop
ReDim lstrInhalt(liZeile - 11) As String
liZeile = 11
Do Until wks.Range("A" & liZeile).Value = ""
For liDoppelt = 0 To liInhalt
If lstrInhalt(liDoppelt) = wks.Range("A" & liZeile).Value Then
lboDoppelt = True
Exit For
End If
Next
If lboDoppelt = False Then
lstrInhalt(liInhalt) = wks.Range("A" & liZeile).Value
liInhalt = liInhalt + 1
Else
lboDoppelt = False
End If
liZeile = liZeile + 1
Loop
Sheets("Preisliste").Kategorie.Clear
For liEintrag = 0 To liInhalt - 1
Sheets("Preisliste").Kategorie.AddItem lstrInhalt(liEintrag)
Next
End Sub
-------------------------------
Sub List_Sortieren()
Dim iLast As Integer, iNext As Integer
Dim iTmp As Integer
With liEintrag
For iLast = 0 To .ListCount - 1
For iNext = iLast + 1 To .ListCount - 1
If .List(iLast) > .List(iNext) Then
iTmp = .List(iLast)
.List(iLast) = .List(iNext)
.List(iNext) = iTmp
End If
Next iNext
Next iLast
End With
End Sub