Gruppe
Dialog
Problem
Bei Auswahl des Blattes "Ergebnis" werden die ComboBoxes neu eingelesen. Eine Werteänderung einer ComboBoxes wirkt sich auf die andere aus.
ClassModule: Tabelle1
Private Sub cboHersteller_Change()
Dim iRow As Integer
cboProdukt.Clear
iRow = 2
With Worksheets("Listen")
Do Until IsEmpty(.Cells(iRow, 1))
If .Cells(iRow, 1).Value = cboHersteller.Value Then
cboProdukt.AddItem .Cells(iRow, 2).Value
End If
iRow = iRow + 1
Loop
End With
If cboProdukt.ListCount > 0 Then
cboProdukt.ListIndex = 0
End If
End Sub
Private Sub cboProdukt_Change()
Dim iRow As Integer
iRow = 2
With Worksheets("Listen")
Do Until IsEmpty(.Cells(iRow, 1))
If .Cells(iRow, 1).Value = cboHersteller.Value And _
.Cells(iRow, 2).Value = cboProdukt.Value Then
Cells(2, 3).Value = .Cells(iRow, 3).Value
Exit Do
End If
iRow = iRow + 1
Loop
End With
End Sub
Private Sub Worksheet_Activate()
Dim col As New Collection
Dim iRow As Integer
cboHersteller.Clear
iRow = 2
On Error Resume Next
With Worksheets("Listen")
Do Until IsEmpty(.Cells(iRow, 1))
col.Add .Cells(iRow, 1).Value, .Cells(iRow, 1).Value
iRow = iRow + 1
Loop
On Error GoTo 0
For iRow = 1 To col.Count
cboHersteller.AddItem col(iRow)
Next iRow
End With
If cboHersteller.ListCount > 0 Then
cboHersteller.ListIndex = 0
End If
End Sub