|
本帖最后由 liulang0808 于 2024-1-4 21:36 编辑
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
Set Rng = Nothing
Application.ScreenUpdating = False
Application.Calculation = xlManual
r = Cells(Rows.Count, "p").End(3).Row
arr = [a1].Resize(r, 16)
For j = 3 To r
d.RemoveAll
If Len(arr(j, 16)) > 0 Then
For i = 1 To Len(arr(j, 16))
d(Val(Mid(arr(j, 16), i, 1))) = ""
Next i
End If
If d.Count = 1 Then
Cells(j, 17) = d.keys()(0)
d(d.keys()(0)) = 0
Else
brr = d.keys
Call sort(d, brr)
Cells(j, 17).Resize(1, d.Count) = brr
End If
For i = 10 To 15
If d.exists(Val(arr(j, i))) Then
Union(Cells(j, i), Cells(j, 17 + d(arr(j, i)))).Interior.ColorIndex = 3
End If
Next i
Next j
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
Sub sort(d, arr)
For j = LBound(arr) To UBound(arr)
x = WorksheetFunction.Small(d.keys, j + 1)
arr(j) = x
d(x) = j
Next j
End Sub
|
|