参与一下。。。- Sub ykcbf() '//2024.2.29
- arr = [a4].CurrentRegion
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- c = 5
- On Error Resume Next
- For i = 3 To UBound(arr)
- m = m + 1
- For j = 1 To c
- brr(m, j) = arr(i, j)
- Next
- For j = 6 To UBound(arr, 2)
- yf = Month(arr(2, j))
- nf = Year(arr(2, j))
- If nf = 2023 Then
- Select Case yf
- Case Is = 1
- brr(m, 6) = brr(m, 6) + arr(i, j)
- Case Is <= 3
- brr(m, 7) = brr(m, 7) + arr(i, j)
- Case Is <= 6
- brr(m, 8) = brr(m, 8) + arr(i, j)
- Case Is <= 9
- brr(m, 9) = brr(m, 9) + arr(i, j)
- Case Is <= 12
- brr(m, 10) = brr(m, 10) + arr(i, j)
- End Select
- End If
- If nf = 2023 Then brr(m, 11) = brr(m, 11) + arr(i, j)
- If nf = 2024 Then brr(m, 12) = brr(m, 12) + arr(i, j)
- If nf = 2025 Then brr(m, 13) = brr(m, 13) + arr(i, j)
- If nf = 2026 Then brr(m, 14) = brr(m, 14) + arr(i, j)
- If nf = 2027 Then brr(m, 15) = brr(m, 15) + arr(i, j)
- Next
- Next
- [a20:z1000] = ""
- Columns(1).NumberFormatLocal = "@"
- [a20].Resize(m, 15) = brr
- MsgBox "OK!"
- End Sub
复制代码
|