Sub 按鈕4_Click()
Dim ARR1()
Set d = CreateObject("scripting.dictionary")
arr = Range("a2:k" & Cells(Rows.Count, 2).End(xlUp).Row)
For i = 1 To UBound(arr)
If Not d.exists(arr(i, 1) & "|" & arr(i, 2)) Then
n = n + 1
d(arr(i, 1) & "|" & arr(i, 2)) = n
ReDim Preserve ARR1(1 To 11, 1 To n)
For j = 1 To 11
ARR1(j, n) = arr(i, j)
Next j
Else
m = d(arr(i, 1) & "|" & arr(i, 2))
For j = 4 To 11
ARR1(j, m) = Val(ARR1(j, m)) + Val(arr(i, j))
Next j
End If
Next
With [m2].Resize(n, 11)
.Columns(2).NumberFormatLocal = "@" '文字格式
.Value = Application.Transpose(ARR1)
End With
End Sub作者: dou10801 時間: 2023-2-5 10:20