WEB YAZILIMLARI VE VBA & EXCEL İLE İLGİLİ KURUMSAL EĞİTİMLER İÇİN BANA 0532 456 53 99 NUMARASI ÜZERİNDEN ULAŞABİLİRSİNİZ.
Option Explicit
Dim ws As Worksheet
Dim i As Long
Dim depth As Long
Public Sub RecursiveDict()
Dim dict As New Scripting.Dictionary
Dim subDict As New Scripting.Dictionary
Dim lvldict As New Scripting.Dictionary
Set ws = Sheet1
ws.UsedRange.Clear
lvldict.Add "LVL KEY", "LVL ITEM"
subDict.Add "Hello", "World"
subDict.Add "Mehmet", "Canbulat"
subDict.Add "Other", lvldict
dict.Add "Merhaba", "Dunya"
dict.Add "Selam", subDict
i = 1
depth = 0
gomuluDictYazdir dict
ws.UsedRange.EntireColumn.AutoFit
End Sub
Private Sub gomuluDictYazdir(d As Dictionary)
Dim Key as Variant
For Each Key In d.Keys
ws.Cells(i, 1).Offset(, depth).Value2 = "KEY: " & Key
If VarType(d(Key)) = 9 Then
depth = depth + 1
gomuluDictYazdir d(Key)
Else
ws.Cells(i, 2).Offset(, depth) = "ITEM: " & d(Key)
End If
i = i + 1
Next Key
End Sub
Негізгі бет EXCEL'DE DICTIONARY ILE RECURSIVE ÇALIŞMAK - KODLAR AÇIKLAMADA
Пікірлер: 23