|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。- Sub ykcbf() '//2024.6.22
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("Sheet1").UsedRange
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For i = 2 To UBound(arr)
- If arr(i, 1) <> Empty Then
- s = arr(i, 1) & "|" & arr(i, 4)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- Else
- r = d(s)
- brr(r, 6) = brr(r, 6) + 1
- brr(r, 7) = IIf(InStr(brr(r, 7), arr(i, 7)), brr(r, 7), brr(r, 7) & "," & arr(i, 7))
- End If
- End If
- Next
- With Sheets("结果")
- .UsedRange.Offset(1).Clear
- .[a2].Resize(m, UBound(arr, 2)) = brr
- .[a2].Resize(m, UBound(arr, 2)).Borders.LineStyle = 1
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|