|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 按钮1_Click()
- Set d = CreateObject("scripting.dictionary")
- Set dn = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Range([w3], Cells(Rows.Count, "aa").End(3)).Offset(1).ClearContents
- For Each rn In Array("3", "4", "9", "2")
- dn(rn) = 0
- Next
-
- For j = 4 To Cells(Rows.Count, "h").End(3).Row
- If dn.exists(Cells(j, 8).Value & "") Then
- If Not d.exists(Cells(j, 8).Value & "") Then
- Set d(Cells(j, 8).Value & "") = Cells(j, "e").Resize(1, 5)
- Else
- Set d(Cells(j, 8).Value & "") = Union(d(Cells(j, 8).Value & ""), Cells(j, "e").Resize(1, 5))
- End If
- dn(Cells(j, 8).Value & "") = dn(Cells(j, 8).Value & "") + 1
- End If
- Next j
- l1:
- If dn.Count <> 0 Then
- mx = WorksheetFunction.Large(dn.items, 1)
- For j = 0 To d.Count - 1
- If dn.items()(j) = mx Then
- rn = dn.keys()(j)
- If d.exists(rn) Then
- d(rn).Copy Cells(Rows.Count, "w").End(3).Offset(1)
- End If
- dn.Remove rn
- Exit For
- End If
- Next
- GoTo l1
- End If
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|