快速删除除当前活动工作表之外的其他所有工作表。
Sub delOtherSheets() '删除其他工作表
Dim sht As Worksheet, thisSht As Worksheet
Dim thisShtName As String
Dim isDel
isDel = MsgBox("是否要删除其他工作表", 1)
If isDel = vbOK Then
'关闭弹窗和屏闪
Application.DisplayAlerts = False
Application.ScreenUpdating = False
'获取当前工作表的名字,简化缩写,关闭筛选
thisShtName = ActiveWindow.ActiveSheet.Name
Set thisSht = ActiveWorkbook.Sheets(thisShtName)
'判断当前表的个数,如果大于1就删除其他表
If Sheets.Count > 1 Then
For Each sht In ActiveWorkbook.Worksheets
If sht.Name <> thisShtName Then
sht.Delete
End If
Next
Else
MsgBox "当前仅一个工作表"
End If
'打开弹窗和屏闪
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
End Sub