|
由于常常整理一些序号,写了二段宏,其中第一段是在A列当中寻找2个相同的序号并同时标上颜色,
第二段是在A列找出2个相同的序号并给于其中一个进行标示文字,
但是现在有一个麻烦,就是当数据达到九十多万笔时,运算较慢,不知何解,特以求助各位,谢谢。
- Sub 在另一列标示重复()
- Dim a, i
- Sheet1.Select
- Columns("b:b").ClearContents
- r = [a1000000].End(3).Row
- arr = Range("a2:a" & r)
- Set a = CreateObject("Scripting.dictionary")
- For i = 1 To UBound(arr)
- If a.exists(arr(i, 1)) Then
- Range("b" & i + 1) = "重复条码"
- n = a(arr(i, 1))
- Range("b" & n + 1) = "找出重复条码"
- Else
- a.Add arr(i, 1), m
- End If
- Next
- Set a = Nothing
- End Sub
复制代码
- Sub 同一列重复标黄色()
- Dim d As Object, i&, n&, rng
- Sheet1.Select
- Set d = CreateObject("Scripting.Dictionary")
- rng = Range([a1], [a1000000].End(xlUp))
- For i = 1 To UBound(rng)
- If d(rng(i, 1)) = "" Then
- d(rng(i, 1)) = i
- Else
- Union(Cells(i, 1), Cells(d(rng(i, 1)), 1)).Interior.ColorIndex = 6
- End If
- Next
- End Sub
复制代码
|
|