Sub 新建工程表格()
Dim i As Integer
Dim y As Integer
Dim arr, x
Application.ScreenUpdating = False
Application.DisplayAlerts = False
y = InputBox("请输入工程数量")
For i = Sheets.Count - 3 To y - 1
Sheets("1").Copy after:=Sheets(i + 1)
ActiveSheet.Name = i + 1
Next
If y <= Sheets.Count - 4 Then
ReDim arr(y + 2 To Sheets.Count - 2)
For x = y + 2 To Sheets.Count - 2
arr(x) = Worksheets(x).Name
Next
Worksheets(arr).Select
ActiveWindow.SelectedSheets.Delete
End If
Sheets("1").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub