| 
    
     |  | まず予め「集計」という名前の新規シートを、挿入しておいて下さい。そして以下の マクロを試してみて下さい。
 
 Sub My集計()
 Dim WS As Worksheet
 Dim C As Range
 Dim xR As Long
 Dim MyC As Variant
 
 On Error GoTo ELine
 Set Sh = Worksheets("集計")
 On Error GoTo 0
 Sh.Cells.ClearContents
 Sh.Range("A1").Value = "番号"
 For Each WS In Worksheets
 If WS.Name = "集計" Then GoTo NLine
 For Each C In WS.Range("A2", WS.Range("A65536").End(xlUp))
 xR = C.Value
 MyC = Application _
 .Match(C.Offset(, 1).Value, Sh.Rows(1), 0)
 If IsError(MyC) Then
 With Sh.Range("IV1").End(xlToLeft).Offset(, 1)
 MyC = .Column
 .Value = C.Offset(, 1).Value
 End With
 End If
 Sh.Cells(xR, MyC).Value = _
 Sh.Cells(xR, MyC).Value + C.Offset(, 2).Value
 Next
 NLine:
 Next
 Set Sh = Nothing: Exit Sub
 ELine:
 Worksheets.Add(After:=Worksheets(Worksheets.Count))
 ActiveSheet.Name = "集計"
 Resume Next
 End Sub
 
 |  |