Sub TEST_A1()
Dim Arr, Brr, i&, j%, K%, V, R&, N&, x%, y%
Arr = [A1].CurrentRegion
ReDim Brr(1 To UBound(Arr) * 3, 1 To 3)
For i = 2 To UBound(Arr)
If Arr(i, 2) > 0 Then V = Arr(i, 2): N = N + 1: R = N: x = 3: y = 2
If Arr(i, 3) > 0 Then V = Arr(i, 3): x = 2: y = 3: R = 0
If Arr(i, 4) + Arr(i, 5) = 0 Then Arr(i, 4) = V
For j = 4 To 5
If Arr(i, j) > 0 Then N = N + 1: Brr(N, 1) = Arr(i, 1): Brr(N, x) = Arr(i, j)
Next j
If R = 0 Then N = N + 1: R = N
Brr(R, 1) = Arr(i, 1): Brr(R, y) = V
Next i
[g2].Resize(N, 3) = Brr
End Sub
|