- Sub 开整()
- Dim Arr, Sht As Worksheet, Brr(1 To 10000, 1 To 11)
- For Each Sht In Worksheets
- If Sht.Name <> "加工明细表" Then
- With Sht
- Arr = .Range("a8:g" & .[d1048576].End(3).Row)
- For i = 1 To UBound(Arr) - 6
- If Arr(i, 2) <> "" Then
- n = n + 1
- Brr(n, 1) = Right(.Cells(5, 1), Len(.Cells(5, 1)) - 6)
- Brr(n, 2) = .Cells(6, 6)
- Brr(n, 3) = .Cells(5, 6)
- Brr(n, 4) = Arr(i, 1)
- Brr(n, 5) = Arr(i, 2)
- Brr(n, 6) = Arr(i, 3)
- Brr(n, 7) = Arr(i, 4)
- Brr(n, 8) = Arr(i, 5)
- Brr(n, 11) = Arr(i, 7)
- End If
- Next
- End With
- End If
- Next
- Sheets("加工明细表").[a5].Resize(UBound(Brr), 8) = Brr
- Sheets("加工明细表").[k5].Resize(UBound(Brr), 1) = Application.Index(Brr, , 11)
- MsgBox "完成"
- End Sub
复制代码
仅供参考
|