新建一個excel檔案,按alt+F11,在左邊點右鍵,插入,模組,雙擊模組,貼上下面的程式碼。然後按F5,執行新建宏。輸入張數,很快就建立完成了。Sub 新建() Dim arr, sh As Worksheet shtNum = Application.InputBox("請輸入複製工作表的張數", Type:=1) If shtNum = 0 Then Exit Sub Application.ScreenUpdating = False On Error Resume Next Application.DisplayAlerts = False Workbooks.Add With ActiveWorkbook For i = 1 To shtNum .Sheets.Add after:=.Sheets(.Sheets.Count) ActiveSheet.Name = "2011-6b-" & i Next i End With Application.ScreenUpdating = TrueEnd Sub
新建一個excel檔案,按alt+F11,在左邊點右鍵,插入,模組,雙擊模組,貼上下面的程式碼。然後按F5,執行新建宏。輸入張數,很快就建立完成了。Sub 新建() Dim arr, sh As Worksheet shtNum = Application.InputBox("請輸入複製工作表的張數", Type:=1) If shtNum = 0 Then Exit Sub Application.ScreenUpdating = False On Error Resume Next Application.DisplayAlerts = False Workbooks.Add With ActiveWorkbook For i = 1 To shtNum .Sheets.Add after:=.Sheets(.Sheets.Count) ActiveSheet.Name = "2011-6b-" & i Next i End With Application.ScreenUpdating = TrueEnd Sub