請測試看看,謝謝
Sub test()
Dim Arr, xD, Brr, T$, i&
Set xD = CreateObject("Scripting.Dictionary")
With Range([f1], [b65536].End(xlUp))
Brr = .Value
.Sort Key1:=.Item(1), Order1:=1, Header:=1
Arr = .Value: .Value = Brr
End With
Arr(1, 5) = "總時數"
For i = 2 To UBound(Arr)
T = Arr(i, 1): xD(T) = xD(T) + Arr(i, 4)
Next
For i = 2 To UBound(Arr): Arr(i, 5) = xD(Arr(i, 1)): Next
[g1].Resize(UBound(Arr), 5) = Arr
End Sub作者: av8d 時間: 2022-11-4 12:09