Combobox gefilterte Liste
09.09.2006 16:05:32
Wolfgang
Mit der Combobox10 wird in einer Userform eine straße aus meiner Tabelle ausgewählt.
Mit ComboBox10_Change() ereignis fülle ich die anderen Comboboxen und ein Textfeld mit den Daten die in der gleichen zeile der tabelle stehen.
Nun das problem wenn ich die tabelle filtere zb beginnt mit"A" zeigt Combobox10 alle Straßen mit dem Anfang "A".
Wähle ich dann aber eine Str. aus werden die Comboboxen nicht korrekt gefüllt, weil sie die Daten aus der falsche zeile haben.
was muß geändert werden damit die korrekte zeile gefunden wird ?
anbei die beiden Makros
'combobox10Straße auswählen gefilter
ComboBox10.AddItem ""
For lngZeile = 2 To wks2.Cells(Rows.Count, 1).End(xlUp).Row
If Not Rows(lngZeile).Hidden Then ComboBox10.AddItem Cells(lngZeile, 1)
Next
' Hier werden die Textboxen aus dem Listindex der Combobox10 (Straße)gefüllt!
Private Sub ComboBox10_Change()
'On Error Resume Next
If ComboBox10.ListIndex <> 0 Then
ComboBox1 = wks2.Cells(ComboBox10.ListIndex + 1, 2)
ComboBox2 = wks2.Cells(ComboBox10.ListIndex + 1, 1)
ComboBox3 = wks2.Cells(ComboBox10.ListIndex + 1, 4)
ComboBox4 = wks2.Cells(ComboBox10.ListIndex + 1, 3)
ComboBox5 = wks2.Cells(ComboBox10.ListIndex + 1, 5)
ComboBox6 = Format(wks2.Cells(ComboBox10.ListIndex + 1, 6), "00")
ComboBox7 = wks2.Cells(ComboBox10.ListIndex + 1, 7)
TextBox1 = wks2.Cells(ComboBox10.ListIndex + 1, 8)
ComboBox8 = wks2.Cells(ComboBox10.ListIndex + 1, 9)
ComboBox9 = wks2.Cells(ComboBox10.ListIndex + 1, 10)
CheckBox1.Value = wks2.Cells(ComboBox10.ListIndex + 1, 11) = "X"
CheckBox2.Value = wks2.Cells(ComboBox10.ListIndex + 1, 12) = "X"
CheckBox3.Value = wks2.Cells(ComboBox10.ListIndex + 1, 13) = "X"
CheckBox4.Value = wks2.Cells(ComboBox10.ListIndex + 1, 14) = "X"
Else
TextBox1 = ""
ComboBox1 = ""
ComboBox2 = ""
ComboBox3 = ""
ComboBox4 = ""
ComboBox5 = ""
ComboBox6 = ""
ComboBox7 = ""
ComboBox8 = ""
ComboBox9 = ""
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
ComboBox10.ListIndex = 0
End If
End Sub
Vielen Dank für die Hilfe
Gruß Wolfgang