Private Sub Workbook_Open() 'シートの自動追加 Dim intN As Integer Dim strN As String Dim strN3 As String Dim intCol As Integer Dim intYar As Integer Dim strN4 As String TM = Month(Date) If TM = 12 And Sheets("集計表").Range("A1") = 0 Then Sheets("集計表").Range("A1").Value = 1 GoTo Jump End If If TM = 11 Then Sheets("集計表").Range("A1").Value = 0 Exit Sub Jump: Sheets("集計表").Select intCol = Range("B3").End(xlToRight).Column intYar = Left(Cells(3, intCol), 4) Cells(3, intCol + 1).Value = intYar + 1 & "年" intN = intYar + 1 strN = intN Sheets.Add after:=Sheets(Sheets.Count) strN3 = Range("A1").Parent.Name Sheets(strN3).Name = strN strN4 = intYar Sheets(strN4).Select Range("B2:DP16").Select Selection.Copy Sheets(strN).Select Range("B2").Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Sheets(strN4).Select Range("B3:DP3").Select Selection.Copy Sheets(strN).Select Range("B3").Select ActiveSheet.Paste PC = 4 For i = 1 To 12 Cells(2, PC - 1).Value = intN Cells(2, PC).Value = "年" & i & "月度仕入" PC = PC + 10 Next Range("A1").Select Application.CutCopyMode = False End Sub