Sub 製番入力() Range("G3").Value = "=""="" & J3" End Sub -------------------------------------------------------------------------- Sub 製番合計抽出() Dim intRow As Integer Dim i As Integer Dim i2 As Integer Dim i4 As Integer Dim Seib(1 To 10) As String Dim S As Integer Dim intCol As Integer Range("l1:O13").ClearContents intRow = Range("J3").End(xlDown).Row S = 1 Seib(S) = Range("J4") intCol = 12 Cells(1, intCol).Value = Seib(1) Cells(3, intCol).Value = Range("I4") Cells(4, intCol).Value = Range("K4") S = S + 1 For i = 5 To intRow Range("J" & i).Select If Range("M1") <> "" Then intCol = Range("L1").End(xlToRight).Column End If For i2 = 1 To intCol - 11 If Range("J" & i) = Seib(i2) Then Cells(i, i2 + 11).Value = Range("K" & i) GoTo Jump End If Next Seib(S) = Range("J" & i) Cells(1, intCol + 1).Value = Seib(S) Cells(3, intCol + 1).Value = Range("I" & i) Cells(i, intCol + 1).Value = Range("K" & i) S = S + 1 Jump: Next For i4 = 12 To intCol If i4 = 12 Then Range("G3").Value = "=""="" & L1" Range("L2").Value = Range("H3") End If If i4 = 13 Then Range("G3").Value = "=""="" & M1" Range("M2").Value = Range("H3") End If If i4 = 14 Then Range("G3").Value = "=""="" & N1" Range("N2").Value = Range("H3") End If If i4 = 15 Then Range("G3").Value = "=""="" & O1" Range("O2").Value = Range("H3") End If Next Cells(intRow + 1, 11).Copy Range(Cells(intRow + 1, 12), Cells(intRow + 1, intCol)).Select ActiveSheet.Paste Application.CutCopyMode = False Cells(intRow + 1, intCol + 1).Value = "=SUM(L13:O13)" End Sub