ich habe ein Userform mit mehreren Comboboxen. Nun habe ich das Problem, daß ich den Inhalt ab und zu überschreiben muß. Bei den Comboboxen 1 bis 10 fiunktioniert das einwandfrei, die Combobxen 11 - 15 lassen sich inhaltlich manuell nicht ändern. Die Eigenschaften aller Comboboxen sind identisch und werden auch per VBA nicht verändert. Hier mein Code :
Private Sub ComboBox1_Change()
Dim i As Integer
Dim imax As Integer
Dim tb As Object
Dim cb As Object
Sheets("VP_Prämien").Activate
Label59.Caption = "Vertriebsprogramm " & ComboBox1.Value & " " & Range("Z1").Value
Sheets("FZ_HST").Activate
With Me.ComboBox2
If ComboBox1.Value = "Abarth" Then
.ListRows = 6
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 3)
Next i
Sheets("VP_Prämien").Activate
If Application.WorksheetFunction.CountA(Range("A:A")) = 0 Then
MsgBox "Für die Marke " & ComboBox1.Value & " sind noch keine Prämien hinterlegt !" & vbCrLf & "Bitte führen Sie das Prämien-Update durch !" & _
vbCrLf & "Dieses finden Sie im Hauptmenu unter DISPOSITION !", vbExclamation, "Fehlende Prämien"
For Each tb In UFLB.Controls
If TypeName(tb) = "TextBox" Then tb.Text = ""
Next tb
For Each cb In UFLB.Controls
If TypeName(cb) = "ComboBox" Then cb.Text = ""
Next cb
Label59.Caption = ""
Exit Sub
End If
With Me.ComboBox11
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("VP_Prämien").Cells(i, 1)
Next i
End With
' ComboBox11.RowSource = "VP_Prämien!A1:A50"
' ComboBox12.RowSource = "VP_Prämien!A1:A50"
' ComboBox13.RowSource = "VP_Prämien!A1:A50"
' ComboBox14.RowSource = "VP_Prämien!A1:A50"
End If
If ComboBox1.Value = "Fiat PKW" Then
.ListRows = 13
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 4)
Next i
Sheets("VP_Prämien").Activate
If Application.WorksheetFunction.CountA(Range("E:E")) = 0 Then
MsgBox "Für die Marke " & ComboBox1.Value & " sind noch keine Prämien hinterlegt !" & vbCrLf & "Bitte führen Sie das Prämien-Update durch !" & _
vbCrLf & "Dieses finden Sie im Hauptmenu unter DISPOSITION !", vbExclamation, "Fehlende Prämien"
For Each tb In UFLB.Controls
If TypeName(tb) = "TextBox" Then tb.Text = ""
Next tb
For Each cb In UFLB.Controls
If TypeName(cb) = "ComboBox" Then cb.Text = ""
Next cb
Label59.Caption = ""
Exit Sub
End If
ComboBox11.RowSource = "VP_Prämien!E1:E50"
ComboBox12.RowSource = "VP_Prämien!E1:E50"
ComboBox13.RowSource = "VP_Prämien!E1:E50"
ComboBox14.RowSource = "VP_Prämien!E1:E50"
End If
If ComboBox1.Value = "Fiat Professional" Then
.ListRows = 6
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 5)
Next i
Sheets("VP_Prämien").Activate
If Application.WorksheetFunction.CountA(Range("I:I")) = 0 Then
MsgBox "Für die Marke " & ComboBox1.Value & " sind noch keine Prämien hinterlegt !" & vbCrLf & "Bitte führen Sie das Prämien-Update durch !" & _
vbCrLf & "Dieses finden Sie im Hauptmenu unter DISPOSITION !", vbExclamation, "Fehlende Prämien"
For Each tb In UFLB.Controls
If TypeName(tb) = "TextBox" Then tb.Text = ""
Next tb
For Each cb In UFLB.Controls
If TypeName(cb) = "ComboBox" Then cb.Text = ""
Next cb
Label59.Caption = ""
Exit Sub
End If
ComboBox11.RowSource = "VP_Prämien!I1:I50"
ComboBox12.RowSource = "VP_Prämien!I1:I50"
ComboBox13.RowSource = "VP_Prämien!I1:I50"
ComboBox14.RowSource = "VP_Prämien!I1:I50"
End If
If ComboBox1.Value = "Alfa Romeo" Then
.ListRows = 7
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 6)
Next i
Sheets("VP_Prämien").Activate
If Application.WorksheetFunction.CountA(Range("C:C")) = 0 Then
MsgBox "Für die Marke " & ComboBox1.Value & " sind noch keine Prämien hinterlegt !" & vbCrLf & "Bitte führen Sie das Prämien-Update durch !" & _
vbCrLf & "Dieses finden Sie im Hauptmenu unter DISPOSITION !", vbExclamation, "Fehlende Prämien"
For Each tb In UFLB.Controls
If TypeName(tb) = "TextBox" Then tb.Text = ""
Next tb
For Each cb In UFLB.Controls
If TypeName(cb) = "ComboBox" Then cb.Text = ""
Next cb
Label59.Caption = ""
Exit Sub
End If
ComboBox11.RowSource = "VP_Prämien!C1:C50"
ComboBox12.RowSource = "VP_Prämien!C1:C50"
ComboBox13.RowSource = "VP_Prämien!C1:C50"
ComboBox14.RowSource = "VP_Prämien!C1:C50"
End If
If ComboBox1.Value = "Jeep" Then
.ListRows = 6
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 7)
Next i
Sheets("VP_Prämien").Activate
If Application.WorksheetFunction.CountA(Range("G:G")) = 0 Then
MsgBox "Für die Marke " & ComboBox1.Value & " sind noch keine Prämien hinterlegt !" & vbCrLf & "Bitte führen Sie das Prämien-Update durch !" & _
vbCrLf & "Dieses finden Sie im Hauptmenu unter DISPOSITION !", vbExclamation, "Fehlende Prämien"
For Each tb In UFLB.Controls
If TypeName(tb) = "TextBox" Then tb.Text = ""
Next tb
For Each cb In UFLB.Controls
If TypeName(cb) = "ComboBox" Then cb.Text = ""
Next cb
Label59.Caption = ""
Exit Sub
End If
ComboBox11.RowSource = "VP_Prämien!G1:G50"
ComboBox12.RowSource = "VP_Prämien!G1:G50"
ComboBox13.RowSource = "VP_Prämien!G1:G50"
ComboBox14.RowSource = "VP_Prämien!G1:G50"
End If
If ComboBox1.Value = "Skoda" Then
.ListRows = 9
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 8)
Next i
End If
If ComboBox1.Value = "Seat" Then
.ListRows = 7
.Clear
imax = ActiveSheet.UsedRange.Rows.Count
For i = 1 To imax
.AddItem Worksheets("FZ_HST").Cells(i, 9)
Next i
End If
End With
End Sub