|
k1 = 3
arr = .Range("A2" & .Range("A65536").End(xlUp).Row)
For x = 1 To UBound(arr)
If arr(x, 1) >= A1 And arr(x, 1) <= A2 Then
If D1.Exists(arr(x, 3)) Then
n = D1(arr(x, 3))
If D2.Exists(arr(x, 2)) Then
m = D2(arr(x, 2))
arr1(m, n) = arr1(m, n) + arr(x, 4)
GoTo AA
Else
k = k + 1
D2(arr(x, 2)) = k
arr1(k, 1) = arr(x, 2)
arr1(k, n) = arr(x, 4)
GoTo AA
End If
Else
k1 = k1 + 1
D1(arr(x, 3)) = k1
arr2(1, k1) = arr(x, 3)
End If
If D2.Exists(arr(x, 2)) Then
m = D2(arr(x, 2))
arr1(m, n) = arr1(m, n) + arr(x, 4)
Else
k = k + 1
D2(arr(x, 2)) = k
arr1(k, 1) = arr(x, 2)
arr1(k, k1 - 1) = arr(x, 4)
End If
End If |
|