Frage zum Code
19.03.2005 18:16:02
Sylvio
habe diesen Code gefunden (original) und wollte ihn anpassen (geändert) aber irgendwas ist da falsch. Keine Ahnung was . :-(
Er sortiert nur die Combobox 2 richtig bei den anderen fehlen werte und leere Zellen werden angezeigt.
Könnt ihr helfen??
Danke im Voraus
MfG Sylvio
original:
Private Sub UserForm_Initialize()
Dim col As New Collection
Dim iRow As Integer
iRow = 3
On Error Resume Next
Do Until IsEmpty(Cells(iRow, 1))
col.Add Cells(iRow, 1), Cells(iRow, 1)
If Err = 0 Then
ComboBox1.AddItem Cells(iRow, 1)
Else
Err.Clear
End If
iRow = iRow + 1
Loop
On Error GoTo 0
ComboBox1.ListIndex = 0
End Sub
geändert:
Private Sub UserForm_Initialize()
Dim col As New Collection
Dim iRow As Integer
iRow = 3
On Error Resume Next
Do Until IsEmpty(Cells(iRow, 1))
col.Add Cells(iRow, 1), Cells(iRow, 1)
If Err = 0 Then
ComboBox1.AddItem Cells(iRow, 1)
ComboBox2.AddItem Cells(iRow, 3)
ComboBox3.AddItem Cells(iRow, 5)
Else
Err.Clear
End If
iRow = iRow + 1
Loop
On Error GoTo 0
ComboBox1.ListIndex = 0
ComboBox2.ListIndex = 0
ComboBox3.ListIndex = 0
End Sub
Code eingefügt mit Syntaxhighlighter 3.0