表头自己弄一下,代码修改如下:
- Sub gj23w98()
- Set d = CreateObject("scripting.dictionary")
- With Sheets("第四次活动会员缴费表")
- r = .Cells(.Rows.Count, 13).End(3).Row
- arr = .Range("a8:p" & r)
- End With
- ReDim brr(1 To UBound(arr), 1 To 6)
- For x = 1 To UBound(arr)
- s = arr(x, 13)
- If d(s) = "" Then
- k = k + 1: d(s) = k
- brr(k, 1) = s
- brr(k, 2) = arr(x, 11)
- brr(k, 3) = arr(x, 7)
- For j = 4 To 6
- brr(k, j) = arr(x, j + 10)
- Next
- Else
- brr(d(s), 2) = arr(x, 11) + brr(d(s), 2)
- brr(d(s), 3) = arr(x, 7) + brr(d(s), 3)
- For j = 4 To 5
- brr(d(s), j) = arr(x, j + 10) + brr(d(s), j)
- Next
- brr(d(s), 6) = brr(d(s), 3) - brr(d(s), 4) - brr(d(s), 5)
- End If
- Next
- With Sheets("单条件多列汇总")
- .[a5].Resize(k, 6) = brr
- End With
- End Sub
复制代码 |