|
- Sub tt()
- Set d = CreateObject("scripting.dictionary")
- arr = Sheet1.[a1].Resize(29, 12) '源数组
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2)) '跟源数组一样大小的空数组
- For i = 3 To UBound(arr)
- d(arr(i, 1)) = i '根据明细表,不同货号应该在的行数
- brr(i, 1) = arr(i, 1): brr(i, 2) = arr(i, 2): brr(i, 3) = arr(i, 3) '1--3列进数组brr
- Next
- For i = 3 To UBound(arr)
- For j = 4 To 10 Step 3
- x = d(arr(i, j)) '不同货号应该在的行数
- If x > 0 Then
- brr(x, j) = arr(i, j): brr(x, j + 1) = arr(i, j + 1): brr(x, j + 2) = arr(i, j + 2) '源数组4--12列内容按行数进入数组Brr
- End If
- Next
- Next
- With Sheet3 '显示brr
- .[a1].Resize(UBound(brr), UBound(brr, 2)) = brr
- Sheet1.Rows("1:2").Copy .Rows(1)
- .Activate
- End With
- End Sub
复制代码 |
|