|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- arr = .Range("m3").CurrentRegion
- For j = 1 To UBound(arr, 2)
- d(arr(1, j)) = Empty
- Next
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a1:e" & r)
- ReDim brr(1 To UBound(arr), 1 To 1)
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If d.exists(arr(i, j)) Then
- brr(i, 1) = brr(i, 1) + 1
- End If
- Next
- Next
- .Range("f1").Resize(UBound(brr), 1) = brr
- .Range("a1:f" & r).Sort key1:=.Cells(1, 6), order1:=xlDescending, Header:=xlNo
- .Columns(6).ClearContents
- End With
- End Sub
复制代码 |
|