Public Sub DeleteNotFirstSheet()
Dim j As Integer
If Worksheets.Count > 1 Then
Application.DisplayAlerts = False
For j = Worksheets.Count To 2 Step -1
Worksheets(Worksheets(j).Name).Delete
Next
Application.DisplayAlerts = True
End If
End Sub
Private Sub Workbook_Open()
ThisWorkbook.DeleteNotFirstSheet
End Sub
我只會刪掉
Sheets
不會關掉
活頁簿
資料請先備份
參考看看
Sub Main()
Application.DisplayAlerts = False
Do While Sheets.Count > 1
Sheets(Sheets.Count).Delete
Loop
Application.DisplayAlerts = True
End Sub