|
点击按钮即可。
在D列显示重复的个数。- Sub lqxs()
- Dim Arr, i&, aa, ys, j&
- Dim d, k, t
- Set d = CreateObject("Scripting.Dictionary")
- Arr = [a1].CurrentRegion
- Cells.Interior.ColorIndex = xlNone
- [d:d].ClearContents
- For i = 2 To UBound(Arr)
- d(Arr(i, 3)) = d(Arr(i, 3)) & i & ","
- Next
- k = d.keys: t = d.items: ys = 2
- For i = 0 To UBound(k)
- t(i) = Left(t(i), Len(t(i)) - 1)
- If InStr(t(i), ",") Then
- aa = Split(t(i), ",")
- ys = ys + 1
- If ys > 56 Then ys = 3
- For j = 0 To UBound(aa)
- Cells(aa(j), 3).Interior.ColorIndex = ys
- Next
- Cells(aa(0), 4) = UBound(aa) + 1
- End If
- Next
- End Sub
复制代码
请见附件。 |
|