In einer UserForm habe ich drei Comboboxen.
cboNamen1, 2 und 3
Sind die CB 1 und 2 aktiviert. so bekomme ich nach der Aktivierung der cboNamen3 nur einen Wert in die Box, wenn ich die Spalte 8 nehme
col.Add wks.Cells(iRow, 1), wks.Cells(iRow, 8)
If Err = 0 Then
cboNamen3.AddItem .Cells(iRow, 8)
In der Spalte 8 ist ein Text.
Nehme ich jedoch die Spalte 7, wo nur Zhlen vorhanden sind, erfolgt kein Eintrag in die CB.
Warum bitte? Wo liegt hier mein Fehler?
Private Sub cboNamen3_Enter()
Dim aRow, iRow As Long
Dim col As New Collection
Dim wks As Worksheet
Set wks = Workbooks("Stellenpläne.xls").Worksheets("Tabelle1")
cboNamen3.Clear
aRow = IIf(IsEmpty(wks.Range("A65536")), wks.Range("A65536").End(xlUp).Row, 65536)
On Error Resume Next
For iRow = 2 To aRow
With wks
If .Cells(iRow, 3) = cboNamen6 _
And .Cells(iRow, 4) = cboNamen5 Then
col.Add wks.Cells(iRow, 1), wks.Cells(iRow, 8)
If Err = 0 Then
cboNamen3.AddItem .Cells(iRow, 8)
Else
Err.Clear
End If
End If
End With
Next iRow
On Error GoTo 0
End Sub
Danke
Josef