Delete the specified worksheet, and then click Delete Sheet from the back, remove the section of the worksheet. code show as below.
Sub delete the worksheet () ' ' Delete Sheet macro ' from the last start deleting ' ' shortcut: Ctrl + d ' ' Sheets (Sheets.Count) .Select ' ActiveWindow.SelectedSheets.Delete ' core Statement ' Sheets (Sheets.Count ) .Delete ' between the partition deletion A = 10 the Application.DisplayAlerts = False the For I = A Sheets.Count the To Sheets (A) .Delete the Next the Application.DisplayAlerts = True End Sub
1, delete the specified worksheet, the core of the statement
Sheets(index).Delete
# Index is the worksheet index number, excel from the beginning. Or enter "indexname", with specific worksheet name instead.
2, delete the last worksheet
Sheets (Sheets.Count) .Delete
# Sheets.Count representatives workbook last a worksheet.
After three, delete the specified location in the worksheet
= A 10 # is assumed to start deleting from 10 workbook, including the first 10 the Application.DisplayAlerts = False # To avoid repeated to confirm the deletion, where deletion confirmation pop off the For I = A # default is the To Sheets.Count step = . 1 Sheets (A) .Delete the Next the Application.DisplayAlerts = True recovery pop state #