|
按顺序排列
Public Sub abc()
Dim ar, rep, i, ii, iii, str, tmp, d
Set d = CreateObject("Scripting.Dictionary")
ar = Range([a2], [a65536].End(3))
Set rep = CreateObject("vbscript.regexp")
rep.Global = True
For i = 1 To UBound(ar)
rep.Pattern = "\d+#"
If ar(i, 1) <> "" Then
ar(i, 1) = rep.Replace(ar(i, 1), "")
str = Split(ar(i, 1), ";")
For ii = 0 To UBound(str)
str(ii) = StrConv(str(ii), 3)
If IsNumeric(str(ii)) And Not Sheet2.[b:b].Find(str(ii), , , 1) Is Nothing Then
str(ii) = Sheet2.[b:b].Find(str(ii), , , 1).Offset(, 1)
End If
d(str(ii)) = d(str(ii)) + 1
Next
For ii = 0 To UBound(str) - 1
For iii = ii + 1 To UBound(str)
If str(iii) < str(ii) Then tmp = str(ii): str(ii) = str(iii): str(iii) = tmp
Next
Next
tmp = ""
For ii = 0 To UBound(str)
If d(str(ii)) > 1 Then
d(str(ii) & "@") = d(str(ii) & "@") + 1
tmp = tmp & "," & str(ii) & d(str(ii) & "@")
Else
tmp = tmp & "," & str(ii)
End If
Next
ar(i, 1) = Right(tmp, Len(tmp) - 1)
tmp = ""
d.RemoveAll
End If
Next
[b2].Resize(UBound(ar)) = ar
End Sub
|
评分
-
1
查看全部评分
-
|