habe ein Problemm, bei dem ich nicht weiterkomme. Vielleicht kann mir jemand helfen.
Auf Userform erst Combobox1 auswählen, dann Combobox2. Beim Verlassen von Combobox2 Wert Combobox2 in Sheets("Kursabfrage") ZelleB1 einfügen. Danach Comboboxen neu laden, CB1 auswählen dann CB2 und Wert CB2 und diesmal in Zelle C1 einfügen und wiederholen bis letzte Zelle F1 mit Wert gefüllt ist.
Hier mein bisheriger Code:
Option Explicit
Dim aRow As Long
Dim col As New Collection
Dim iRow, x As Long
Private Sub ComboBox1_Change()
ComboBox2.Clear
On Error Resume Next
For iRow = 2 To aRow
col.Add Cells(iRow, 2), Cells(iRow, 2)
If Err = 0 And Cells(iRow, 1) = ComboBox1.Value Then
ComboBox2.AddItem Cells(iRow, 2)
Else
Err.Clear
End If
Next iRow
On Error GoTo 0
For x = col.Count To 1 Step -1
col.Remove (x)
Next x
End Sub
Private Sub UserForm_Initialize()
Sheets("Kürzel").Activate
aRow = IIf(IsEmpty(Range("A162")), Range("A162").End(xlUp).Row, 162)
On Error Resume Next
For iRow = 2 To aRow
col.Add Cells(iRow, 1), Cells(iRow, 1)
If Err = 0 Then
ComboBox1.AddItem Cells(iRow, 1)
Else
Err.Clear
End If
Next iRow
On Error GoTo 0
Sheets("Kürzel").Select
Label1.Caption = Range("A1").Value
Label2.Caption = Range("B1").Value
End Sub
Private Sub ComboBox2_Afterupdate()
Sheets("Kursabfrage").Activate
Range("B1").Value = ComboBox2.Value
if cells(1,2) = >0 Then
Range("C1").Value = ComboBox2.Value
ElseIf
cells(1,3) = >0 Then 'usw.
'ComboBox2.Clear
'UserForm_Initialize
End Sub
Vielen Dank schon mal im Voraus!!!
Gruß
Bernd