学习了UNARTHUR兄集合的用法,做的 用时1秒 用集合筛选不重复值,真是太快了!!! Private Sub CommandButton1_Click() t = Timer Dim col As New Collection On Error Resume Next arr = Range("a1:a65536") '目标列转到数组,跑得快 ar = Range("z1:z65536") '随便找个空列,建个数组 For a = 1 To [a65536].End(xlUp).Row aa = arr(a, 1) Do While InStr(aa, ",") <> 0 '找"," 找到就分 x = InStr(aa, ",") col.Add Mid(aa, 1, x - 1), Mid(aa, 1, x - 1) '","之前的加入到集合 aa = Mid(aa, x + 1, Len(aa) - x) '","之后的 Loop col.Add aa, aa '没有","的加入到集合 Next a For Each xxx In col '集合转到数组 ar(i + 1, 1) = xxx i = i + 1 Next Range("b1:b" & col.Count) = ar Range("g1") = Timer - t End Sub
附:不等号的发帖方法
<>
& l t ; = <
& g t ; = >
[此贴子已经被作者于2006-6-12 1:13:53编辑过] |