|
- Sub 按钮1_Click()
- Set d = CreateObject("scripting.dictionary")
- Set dn = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Range([w3], Cells(Rows.Count, "ab").End(3)).Offset(1).ClearContents
-
- For j = 4 To Cells(Rows.Count, "h").End(3).Row
- If Len(Cells(j, 8).Value) <> 0 Then
- If Not d.exists(Cells(j, 6) & Cells(j, 7)) Then
- Set d(Cells(j, 6) & Cells(j, 7)) = Cells(j, "e")
- Else
- Set d(Cells(j, 6) & Cells(j, 7)) = Union(d(Cells(j, 6) & Cells(j, 7)), Cells(j, "e"))
- End If
- dn(Cells(j, 6) & Cells(j, 7)) = dn(Cells(j, 6) & Cells(j, 7)) + 1
- End If
- Next j
- a = 1
- l1:
- If dn.Count <> 0 And a < 51 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
- r1 = Cells(Rows.Count, "x").End(3).Offset(1).Row
- d(rn).Copy Cells(r1, "w")
- d(rn).Offset(0, 1).Copy Cells(r1, "x")
- d(rn).Offset(0, 2).Copy Cells(r1, "y")
- d(rn).Offset(0, 3).Copy Cells(r1, "aa")
- d(rn).Offset(0, 4).Copy Cells(r1, "ab")
-
- r2 = Cells(Rows.Count, "w").End(3).Row
- Range(Cells(r1, "z"), Cells(r2, "z")).Value = dn(rn)
- End If
- dn.Remove rn
- Exit For
- End If
- Next
- GoTo l1
- End If
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|