Hello,
I'm trying to populate the yellow cells with the same values as shown in the green cells using the dictionary object. What am I doing wrong?
I appreciate your help.
Printable View
Hello,
I'm trying to populate the yellow cells with the same values as shown in the green cells using the dictionary object. What am I doing wrong?
I appreciate your help.
Thanks. I studied the content of the links to be able to get the content of the first array to the second. I tried with
but the b(i, ii) = .Item(b(i, 1))(ii) did not bring the content of the first array, but gives a type mismath error.Code:b = ActiveSheet.Range("J2:L9").Value
For i = 1 To UBound(b, 1)
If .Exists(b(i, 1)) Then
For ii = 1 To number_of_columns
b(i, ii) = .Item(b(i, 1))(ii)
Next ii
End If
Next i
End With
did not bring me any closerCode:b(i, ii) = a(b(i, 1), (ii))
b(dimension, index) = a(dimension(index, index), (index))Code:b(i, ii) = a(b(i, 1), (ii))
I give up :dunno
This is meaninglessShow the entire code. What you showed in posts #3 and #4 is not enough.Code:a(b(i, 1), (ii))
You will have to put the values into the dictionary first
Code:b = ActiveSheet.Range("J2:L9").Value
with createobject("scripting.dictionary")
For i = 1 To UBound(b, 1)
.item(b(i,1))=application.index(b,i)
Next
msgbox join(.item()(3))
End With
The code is
Code:Sub Start_It()
number_of_columns = 2
a = ActiveSheet.Range("A2:C30").Value
With CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a, 1)
.Item(a(i, 1)) = a(i, 1)
For ii = 1 To number_of_columns
.Item(a(i, 1 + ii)) = a(i, 1 + ii)
Next ii
Next
b = ActiveSheet.Range("J2:L9").Value
For i = 1 To UBound(b, 1)
If .Exists(b(i, 1)) Then
For ii = 1 To number_of_columns
b(i, ii) = a(b(i, 1), (ii))
Next ii
End If
Next i
End With
ActiveSheet.Range("K2:L9").Value = b
End Sub