Is it possible to extract the nth key from a dictionary and its value in VBA? Something like
For i = 1 To Counter + diccompare.Count - UBound(RecSource)
WS.Cells(Lastrow + i, "A") = diccompare.Keys(UBound(RecSource) - Counter + i)
Next
Where I am trying to assign the Cell(Lastrow +i) the value of the key in dictionary diccompare(UBound(RecSource) - Counter + i)
Not sure if I fully got you, something like this
Sub KeyTest()
Dim d As New Scripting.Dictionary
d.Add "Test1", 1
d.Add "Test2", 2
d.Add "Test3", 99
Debug.Print d.Keys()(1)
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With