Ich habe hier im Forum nachfolgenden Code gefunden und angepasst. Bei einem Schritt komme ich aber nicht weiter:
ComboBoxOrt ist abhängig von ComboBoxStr - ComboBoxTransp ist abhängig von ComboBoxOrt.
Ereichen möchte ich, dass statt der ComboBoxTransp eine Textbox angesprochen wird, da hier jeweils nur 1 Wert vorkommen kann.
Kann mir bitte Jemand helfen, probiere schon seit 2 Stunden vergeblich.
Hier der Code:
Private Sub UserForm_Initialize()
Dim hshA As Object
Dim i As Long
Set hshA = CreateObject("Scripting.Dictionary")
With ThisWorkbook.Sheets("Strassen")
For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
hshA(.Cells(i, 1).Text) = 0
Next
Me.ComboBoxStr.List = hshA.Keys
End With
Set hshA = Nothing
End Sub
Private Sub ComboBoxStr_Change()
Dim hshB As Object
Dim i As Long
Set hshB = CreateObject("Scripting.Dictionary")
Me.ComboBoxOrt.Clear
Me.ComboBoxTransp.Clear
With ThisWorkbook.Sheets("Strassen")
For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(i, 1) = Me.ComboBoxStr Then
hshB(.Cells(i, 2).Text) = 0
End If
Next
Me.ComboBoxOrt.List = hshB.Keys
End With
Set hshB = Nothing
End Sub
Private Sub ComboBoxOrt_Change()
Dim hshC As Object
Dim i As Long
Set hshC = CreateObject("Scripting.Dictionary")
Me.ComboBoxTransp.Clear
With ThisWorkbook.Sheets("Strassen")
For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(i, 2) = Me.ComboBoxOrt Then
hshC(.Cells(i, 3).Text) = 0
End If
Next
Me.ComboBoxTransp.List = hshC.Keys
End With
Set hshC = Nothing
End Sub
Danke fürs lesen!mfg, Andreas