I added also tableName column and now i am trying to hve 3 nested dictionaries keys:
Sub test()
Dim DicDdlDml As Object
Dim ArrayDDL As Variant
Dim ArrTest As Variant
Dim e As Variant
Dim i, y As Long
Dim InnerDic As Object
Set DicDdlDml = CreateObject("Scripting.dictionary")
'Set DicDdlDml("DDL") = CreateObject("Scripting.dictionary")
'Set DicDdlDml("DML") = CreateObject("Scripting.dictionary")
With Worksheets(1)
ArrayDDL = .UsedRange.Offset(1, 0).Resize(.UsedRange.Rows.Count - 1)
For i = 1 To UBound(ArrayDDL)
Set InnerDic = CreateObject("Scripting.dictionary")
ReDim ArrTest(1 To UBound(ArrayDDL, 2) - 1)
If Not DicDdlDml.exists(ArrayDDL(i, 1)) Then
For y = 2 To UBound(ArrayDDL, 2)
ArrTest(y - 1) = ArrayDDL(i, y)
Next y
If Not DicDdlDml.exists(ArrTest(4)) Then
Set DicDdlDml("table1") = CreateObject("Scripting.Dictionary")
Set DicDdlDml("table1")("DDL") = CreateObject("Scripting.Dictionary")
DicDdlDml("table1")("DDL").Add ArrayDDL(i, 1), ArrTest
For Each e In DicDdlDml("DDL").keys
Debug.Print e
Dim arrTest2 As Variant
arrTest2 = DicDdlDml("DDL")(e)
Debug.Print
Next e
DicDdlDml("table1")("DDL").Add ArrayDDL(i, 1), ArrTest
End If
If Not DicDdlDml("DDL").exists(ArrayDDL(i, 1)) Then
DicDdlDml("DDL").Add ArrayDDL(i, 1), ArrTest
End If
End If
Next i
End With
End Sub
but this is not working.
It would be awesome to have hierarchy like:
dic(tableName) --> Dic(DDL) or Dic(DML) --> dic(ColumName)
Modified workbook in attachment,
best,
Jacek
Bookmarks