|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 ykcbf1100 于 2024-12-20 09:17 编辑
参与一下。。。
- Sub ykcbf() '//2024.12.20
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- r = Cells(Rows.Count, 1).End(3).Row
- arr = [a1].Resize(r, 6).Value
- On Error Resume Next
- For i = 2 To UBound(arr)
- st = Split(arr(i, 6), "+")
- stt = Split(arr(i, 1), "-")
- For x = 0 To UBound(st)
- s = st(x)
- If Not d.exists(s) Then
- d(s) = Array(stt(0), 1, arr(i, 4))
- Else
- t = d(s)
- If InStr(t(0), stt(0)) = 0 Then t(0) = t(0) & "|" & stt(0)
- t(1) = t(1) + 1
- t(2) = t(2) + arr(i, 4)
- d(s) = t
- End If
- Next
- Next
- ReDim brr(1 To d.Count, 1 To 4)
- For Each k In d.keys
- m = m + 1
- brr(m, 1) = k
- t = d(k)
- k = Split(t(0), "|")
- brr(m, 2) = UBound(k) + 1
- brr(m, 3) = t(1)
- brr(m, 4) = t(2)
- Next
- [m2].Resize(1000, 4) = ""
- [m2].Resize(m, 4) = brr
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|