The highlighted part went wrong. Not sure if I was checking the bug correctly but I checked the local window:
arraydic(1,2) is variant/double and arraychess(1,2) is null but type variant/variant(0 to 1)
is that the root cause and how do I solve it? Thanks in advance!
arraydic(1,2) is variant/double and arraychess(1,2) is null but type variant/variant(0 to 1)
is that the root cause and how do I solve it? Thanks in advance!
Rich (BB code):
Sub jaisdj()
Dim arraydic
Dim arraychess(1 To 20, 1 To 3)
Dim d As New Dictionary
Dim x, k, y
arraydic = Range("a2:c" & Cells(1000, "c").End(xlUp).Row)
For x = 1 To UBound(arraydic)
If d.Exists(arraydic(x, 1)) Then
y = d(arraydic(x, 1))
arraychess(y, 2) = arraychess(y, 2) + arraydic(x, 2)
arraychess(y, 3) = arraychess(y, 3) + arraydic(x, 3)
Else
k = k + 1
d(arraydic(x, 1)) = k
arraychess(k, 1) = Array(x, 1)
arraychess(k, 2) = Array(x, 2)
arraychess(k, 3) = Array(x, 3)
End If
Next x
Range("f2").Resize(k, 3) = arraychess
End Sub
Last edited by a moderator: