|
参与一下。。。
- Sub ykcbf() '//2024.3.25
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("Sheet1")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 1)
- End With
- ReDim brr(1 To UBound(arr), 1 To 3)
- For i = 1 To UBound(arr)
- b = Split(arr(i, 1))
- s = b(0) & "|" & b(1)
- d(s) = d(s) + 1
- Next
- For Each k In d.Keys
- m = m + 1
- brr(m, 1) = Split(k, "|")(0)
- brr(m, 2) = Split(k, "|")(1)
- brr(m, 3) = d(k)
- Next
- With Sheets("Sheet2")
- .UsedRange.Offset(1) = ""
- .[a1].Resize(1, 3) = Array("名称", "码数", "数量")
- .[a2].Resize(m, 3) = brr
- .[a1].Resize(m + 1, 3).Borders.LineStyle = 1
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|