ich komm und komm nicht drauf !!
ich hab vier Comboboxen die sich in Abhängigkeit füllen sollen:
Combobox1 liest die Strasse - Combobox 2 soll nur die möglichen Namen vorschlagen - Combobox3 nur die möglichen Nummern mit der Kombi Straße-Name und Combobox4
die möglichen Inhalte mit der Kombi Straße-Name-Nummer
die erste Kombi flutscht aber dann scheiters bei mir
Ich hab folgenden Code vom Forum:
Private Sub UserForm_Initialize()
Dim letzte, ia, ort As String
letzte = Range("A10000").End(xlUp).Row
For ia = 2 To letzte
ort = Cells(ia, 1)
If Cells(ia, 1) "" And Cells(ia, 1) Cells(ia - 1, 1) Then ComboBox1.AddItem ort
Next
End Sub
Private Sub ComboBox1_Change()
Dim straße As String, ia, letzte
letzte = Range("A10000").End(xlUp).Row
ComboBox2.Clear
For ia = 2 To letzte
straße = Cells(ia, 2)
If Cells(ia, 1) = ComboBox1 And Cells(ia, 2) Cells(ia - 1, 2) Then ComboBox2.AddItem _
straße
Next
End Sub
Private Sub ComboBox2_Change()
Dim nummer As String, ia, letzte
letzte = Range("A10000").End(xlUp).Row
ComboBox3.Clear
For ia = 2 To letzte
nummer = Cells(ia, 3)
If Cells(ia, 2) = ComboBox2 Then ComboBox3.AddItem nummer
Next
End Sub
Private Sub ComboBox3_Change()
Dim zaunfarbe As String, ia, letzte
letzte = Range("A10000").End(xlUp).Row
ComboBox4.Clear
For ia = 2 To letzte
zaunfarbe = Cells(ia, 4)
If Cells(ia, 1) = ComboBox1 And Cells(ia, 2) = ComboBox2 And Cells(ia, 3) = ComboBox3. _
Text Then ComboBox4.AddItem zaunfarbe
Next
End Sub
Was müßte wo angepaßt werden, damit das funktioniert.
im voraus vielen Dank für euere Hilfe
ein dankbarer Ludicla.