AW: Listbox filtern Combobox
18.10.2011 14:57:19
mäxl
Hi
ich habe deinen Code mal nicht verwendet
und durch diesen ersetzt. (Die Combos habe ich auch abhängig gemacht..., wäre doch blöd wenn ich was auswählen könnte und das gibt es gar nicht für das was zuvor gewählt worden ist ^^)
Public chk As Boolean
Sub checkit()
Dim ar(4) As Variant, objMyDic As Object, i As Long, tempStr1 As String, tempStr2 As String, _
IntC As Integer, row_ As Integer
Set objMyDic = CreateObject("Scripting.Dictionary")
If chk = True Then
Cont4.Clear
For i = 1 To 3
If Controls("Cont" & i).Value = "" Then ar(i - 1) = "*" Else ar(i - 1) = Controls("Cont" _
& i).Value
tempStr1 = tempStr1 & ar(i - 1) & "/"
Controls("Cont" & i).Clear
Controls("Cont" & i) = IIf(ar(i - 1) = "*", "", ar(i - 1))
Next
For IntC = 1 To 3
For i = 10 To Cells(Rows.Count, 1).End(xlUp).Row
tempStr2 = Cells(i, 1) & "/" & Cells(i, 2) & "/" & Cells(i, 3) & "/"
If tempStr2 Like tempStr1 Then
On Error Resume Next
objMyDic.Add Cells(i, IntC).Value, 0
If Err.Number = 0 And IntC = 1 Then
Cont4.AddItem Cells(i, 1)
Cont4.List(row_, 1) = Format(Cells(i, 2), "0%")
Cont4.List(row_, 2) = Cells(i, 3)
row_ = row_ + 1
End If
On Error GoTo 0
End If
Next
Controls("Cont" & IntC).List = objMyDic.keys
objMyDic.RemoveAll
Next
End If
Set objMyDic = Nothing
chk = False
End Sub
und ein paar Change Eregnisse beruhen darauf.
anbei noch die Datei, passt es so?
https://www.herber.de/bbs/user/77070.xlsm
gruß
mäxl