I'm exploring the Dictionary object and have an array of them in myArray(x,y).
Some of them have only 1 entry - that is, their .Count is 1. How do I extract its value/or key?
At the moment I'm using a loop:
[vba]If myArray(1, 3).Count = 1 Then
For Each Key In myArray(1, 3)
zz = Key
Next Key
End If[/vba]
Why? because when I try the likes of.. see picture for the rest.
Attachment 1969
Any ideas?
ps.
Some code to set up the scenario above (have a single digit in cell A3 of the active sheet):
[vba]Sub sample()
Dim myArray(1 To 4, 1 To 4)
For i = 1 To 4
For j = 1 To 4
Set x = CreateObject("Scripting.Dictionary")
If Len(Cells(i, j).Value) = 1 Then
x.Add CInt(Cells(i, j).Value), CInt(Cells(i, j).Value)
Else
For k = 1 To 4
x.Add k, k
Next k
End If
Set myArray(i, j) = x
Next j
Next i
Stop
End Sub
[/vba]