AW: ComboBox aufsteigende Werteliste
01.11.2010 12:25:52
Nepumuk
Hallo,
klar:
' **********************************************************************
' Modul: UserForm4 Typ: Userform
' **********************************************************************
Option Explicit
Private Sub UserForm_Activate()
'**********************Nur zum Testen***********************
Dim intIndex As Integer
With ComboBox1
For intIndex = 10 To 1 Step -1
.AddItem intIndex
Next
End With
'***********************************************************
Call prcSort(0, ComboBox1.ListCount - 1)
End Sub
Private Sub prcSort(lngLBorder As Long, lngUBorder As Long)
Dim lngIndex1 As Long, lngIndex2 As Long
Dim strBuffer As String, strTemp As String
lngIndex1 = lngLBorder
lngIndex2 = lngUBorder
strTemp = ComboBox1.List((lngLBorder + lngUBorder) \ 2)
Do
Do While ComboBox1.List(lngIndex1) < strTemp
lngIndex1 = lngIndex1 + 1
Loop
Do While strTemp < ComboBox1.List(lngIndex2)
lngIndex2 = lngIndex2 - 1
Loop
If lngIndex1 <= lngIndex2 Then
strBuffer = ComboBox1.List(lngIndex1)
ComboBox1.List(lngIndex1) = ComboBox1.List(lngIndex2)
ComboBox1.List(lngIndex2) = strBuffer
lngIndex1 = lngIndex1 + 1
lngIndex2 = lngIndex2 - 1
End If
Loop Until lngIndex1 > lngIndex2
If lngLBorder < lngIndex2 Then Call prcSort(lngLBorder, lngIndex2)
If lngIndex1 < lngUBorder Then Call prcSort(lngIndex1, lngUBorder)
End Sub
Gruß
Nepumuk