|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.11.15
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("工序查询")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a9].Resize(r - 8, 8)
- End With
- ReDim brr(1 To r, 1 To 4)
- For i = 2 To UBound(arr)
- s = arr(i, 6)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = s
- brr(m, 2) = 1
- brr(m, 3) = arr(i, 7)
- brr(m, 4) = arr(i, 8)
- Else
- r = d(s)
- brr(r, 2) = brr(r, 2) + 1
- brr(r, 3) = brr(r, 3) + arr(i, 7)
- brr(r, 4) = brr(r, 4) + arr(i, 8)
- End If
- Next
- With Sheets("工序导出")
- .[d5].Resize(5, 4) = ""
- .[d5].Resize(m, 4) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|