|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
這都是基本套路了//反反復復的寫//
Sub TEST_A1()
Dim Arr, Brr, xD, i&, x%, y%, D$, R&, N&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([a1], [m65536].End(3))
ReDim Brr(1 To UBound(Arr), 1 To 5)
For i = 2 To UBound(Arr)
If Not IsDate(Arr(i, 13)) Then GoTo i01
D = Format(Arr(i, 13) - 15, "yyyy/mm")
R = xD(D)
If R = 0 Then N = N + 1: R = N + 1: xD(D) = R: Brr(R, 1) = "'" & D
For j = 1 To 3
x = Mid(245, j, 1): y = Array(0, 7, 9, 10)(j)
Brr(1, x) = Brr(1, x) + Arr(i, y)
Brr(R, x) = Brr(R, x) + Arr(i, y)
Next j
i01: Next i
[o2:s900].ClearContents
With [o2].Resize(N + 1, 5)
.Value = Brr
.Item(1) = "TOTAL"
.Sort .Item(1), 1, , , , , , xlNo
End With
End Sub
|
|