I have a macro that is supposed to help me transform many to many relationships into many to one relationships.
For example, if I have a SKU, and an order to a certain country attached to that SKU, and then a re-currence of that same country/SKU combination, I want to create a line by line table that contains JUST the SKU, and then in the neighboring cell a comma separated list of values of all the countries that the has sold in. I am getting a Run-time Application error on this. I do not know why.
Can someone please take a look at this and help me out when they have a moment?
I have added a couple of stars and errors, indicating where the error occurs.
Sub SteveOranjin()
Dim Cl As Range
'''This is all in VBA for EXCEL:
With CreateObject("scripting.dictionary")
For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
If Not .exists(Cl.Value) Then
.Add Cl.Value, Cl.Offset(, 1).Value
Else
.Item(Cl.Value) = .Item(Cl.Value) & ", " & Cl.Offset(, 1).Value
End If
Next Cl
Range("F2").Resize(.Count, 2).Value = Application.Transpose(Array(.keys, .items)) ' ***[error here.]***
End With
End Sub

Range("A" & Rows.Count).End(xlUp)gets calculated everytime the loop runs ;)