- Sub ReLst()
- Dim Arr(1 To 65535, 1 To 5), i%
- Dim Ary, k%, j%, icl%
- Ary = Range("A1", [A65536].End(3)(1, 5))
- For icl = 1 To 5
- Arr(1, icl) = Split("Drawing_Number,PO_Number,Delivery_Date,BOX NO,PQ", ",")(icl - 1)
- Next
- i = 1
- For k = 2 To UBound(Ary)
- icl = Ary(k, 4) \ Ary(k, 5) - (Ary(k, 4) Mod Ary(k, 5) > 1)
- For j = 1 To icl
- i = i + 1
- Arr(i, 1) = Ary(k, 1)
- Arr(i, 2) = Ary(k, 2)
- Arr(i, 3) = Ary(k, 3)
- Arr(i, 4) = " " & j & "/" & icl
- Arr(i, 5) = IIf(j = icl, Ary(k, 4) Mod Ary(k, 5), Ary(k, 5))
- If Arr(i, 5) = 0 Then Arr(i, 5) = Ary(k, 5)
- Next
- Next
- [G1].Resize(i, 5) = Arr
- End Sub
复制代码 |