Sub test2()
Dim Arr, xD, a, T, i&
Set xD = CreateObject("Scripting.Dictionary")
Tm = Timer
Arr = Range("h6:h" & Cells(Rows.Count, 8).End(xlUp).Row)
For i = 1 To UBound(Arr)
T = Arr(i, 1): If T <> "" Then xD(T) = ""
Next
For i = 1 To xD.Count
a = Application.Large(xD.keys, i)
n = n + 1: xD(a) = n
Next
For i = 1 To UBound(Arr)
T = Arr(i, 1)
If T = "" Then Arr(i, 1) = 0: GoTo 99
Arr(i, 1) = xD(T)
99: Next
Range("j6").Resize(UBound(Arr)) = Arr
MsgBox Timer - Tm
End Sub
Sub ±Æ¦W()
Dim Arr, Brr, xD, V&, i&, j&, k&, N&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([h1], [h1].Cells(Rows.Count, 1).End(3))
ReDim Brr(1 To UBound(Arr) + 1)
For i = 6 To UBound(Arr)
If Arr(i, 1) = "" Then GoTo i01
V = Arr(i, 1)
If xD.Exists(V) Then GoTo i01 Else xD(V) = "": N = N + 1
For j = N To 1 Step -1
If V >= Brr(j) Then Brr(j + 1) = Brr(j) Else Exit For
Next j
Brr(j + 1) = V
i01: Next i
xD.removeall
For j = 1 To N: xD(Brr(j)) = j: Next
'------------------------------------
For i = 6 To UBound(Arr)
V = xD(Arr(i, 1))
If Arr(i, 1) = "" Then V = 0
Arr(i - 5, 1) = V
Next i
[i6].Resize(UBound(Arr) - 5) = Arr
Set xD = Nothing: Erase Arr, Brr
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column <> [h1].Column Then Exit Sub
If .Row < 6 Or .Count > 1 Then Exit Sub
Call ±Æ¦Wtest02
End With
End Sub
'°Ñ¦Ò ikboy ¾Ç²ßSystem.collections.arraylist
Sub ±Æ¦WAmoKatקï()
tm = Timer
Dim d As Object, a, k, t, xL As Object, n&
a = Range("h6:h" & [h1048576].End(3).Row)
Set d = CreateObject("scripting.dictionary") '¦r¨å¨ú°ß¤@È
For Each k In a: If k <> "" Then d(k) = 0: Next
Set xL = CreateObject("System.collections.arraylist") '±Æ§Ç§@·~
For Each k In d.keys: xL.Add k: Next
xL.Sort 'Sorted Ascending
xL.Reverse 'Reverse sort
For i = 1 To xL.Count: d(xL(i - 1)) = i: Next '±Æ§Ç§Ç¸¹(±Æ¦W)¼g¤J¦r¨å
For i = 1 To UBound(a)
If a(i, 1) = "" Then a(i, 1) = 0 Else a(i, 1) = d(a(i, 1)) '±Æ¦W¼g¤Ja°}¦C
Next
[i6].Resize(UBound(a)) = a 'a°}¦C¼g¤J I Äæ¦ì
Debug.Print Timer - tm, "End" '31.40" §ïµ½¬° 0.332"
End Sub