Probleme mit VBA Code
17.10.2012 19:03:33
Luzi76
habe eine USerForm mit folgendem Code erstellt.
Option Explicit
Dim D As Object
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub ComboBox1_Change()
ComboBox2.List = D(ComboBox1.Value).Keys
ComboBox2.Value = Empty
ListBox1.Clear
End Sub
Private Sub ComboBox2_Change()
If ComboBox2.Value = Empty Then Exit Sub
ListBox1.List = D(ComboBox1.Value)(ComboBox2.Value).Keys
End Sub
Private Sub UserForm_Initialize()
Dim lz As Long, ar As Variant
Dim i As Long
With Tabelle8
lz = .Cells(.Rows.Count, 1).End(xlUp).Row
If lz >= 10 Then
ar = .Range("A10:N" & lz).Value
Else
MsgBox "Keine Daten!", vbExclamation, "Abbruch!"
End
End If
End With
Set D = CreateObject("scripting.dictionary")
For i = 1 To UBound(ar)
If Not D.Exists(ar(i, 3)) Then _
Set D(ar(i, 3)) = CreateObject("scripting.dictionary")
If Not D(ar(i, 3)).Exists(ar(i, 5)) Then _
Set D(ar(i, 3))(ar(i, 5)) = CreateObject("scripting.dictionary")
If Not D(ar(i, 3))(ar(i, 5)).Exists(ar(i, 13)) Then _
Set D(ar(i, 3))(ar(i, 5))(ar(i, 13)) = CreateObject("scripting.dictionary")
D(ar(i, 3))(ar(i, 5))(ar(i, 13)) = 0
Next
ComboBox1.List = D.Keys
End Sub
Leider wird mir aber nicht alles angezeigt was ich an Daten haben möchte.wie müsste ich den Code umbauen damit die Daten aus Spalte A und D auch angezeigt werden.
Versuche die Mappe mal mit hochzuladen.
https://www.herber.de/bbs/user/82169.xlsm
Danke für eure Hilfe