|
編集作業をマクロ化すると
こんなかんじで書けると思います。
Sub 集計()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim rowA As Long
Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")
With sh1.Range("C2", sh1.Range("C65536").End(xlUp)).Offset(, 1)
.Formula = "=A2&MONTH(B2)"
.Value = .Value
End With
With sh2.Range("B1:M1")
.Value = Array(4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3)
.NumberFormatLocal = "0""月"""
End With
rowA = sh2.Range("A65536").End(xlUp).Row
With sh2.Range("B2").Resize(rowA - 1, 12)
.Formula = "=SUMIF(Sheet1!$D:$D,$A2&B$1,Sheet1!$C:$C)"
.Value = .Value
End With
sh1.Columns("D").ClearContents
End Sub
|
|