|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.12.16
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- r = Cells(Rows.Count, 3).End(3).Row
- arr = [a1].Resize(r, 16)
- For i = 5 To UBound(arr)
- s = arr(i, 16)
- d(s) = d(s) + arr(i, 7)
- d1(s) = d1(s) + 1
- Next
- For i = 5 To UBound(arr)
- s = arr(i, 16)
- If d1(s) > 1 Then
- m = Application.Sum(Cells(i, 8).Resize(, 4))
- If m = 0 Then
- arr(i, 7) = ""
- Else
- arr(i, 7) = d(s)
- End If
- End If
- Next
- [g1].Resize(r, 1) = Application.Index(arr, 0, 7)
- Set d = Nothing
- Set d1 = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|