excel如何用vba代码删除从第三个工作表以后的所有表只保留前两个
excel如何用vba代码删除从第三个工作表以后的所有表只保留前两个(名字都是不确定的,不是固定的sheet+数字)...
excel如何用vba代码删除从第三个工作表以后的所有表只保留前两个(名字都是不确定的,不是固定的sheet+数字)
展开
展开全部
Sub delSheet()
Application.DisplayAlerts = False
If Worksheets.Count >= 3 Then
For i = Worksheets.Count To 3 Step -1
Worksheets(i).Delete
Next
End If
Application.DisplayAlerts = True
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub test()
Dim Sht As Worksheet, n As Integer, i As Integer
Application.DisplayAlerts = False
If Sheets.Count > 2 Then End
n = ActiveWorkbook.Sheets.Count
For i = n To 3 Step -1
Sheets(i).Delete
Next i
Application.DisplayAlerts = True
End Sub
Dim Sht As Worksheet, n As Integer, i As Integer
Application.DisplayAlerts = False
If Sheets.Count > 2 Then End
n = ActiveWorkbook.Sheets.Count
For i = n To 3 Step -1
Sheets(i).Delete
Next i
Application.DisplayAlerts = True
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Sub test()
Dim x%
x = Sheets.Count
For i = x To 3 Step -1
Sheets(i).Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Next
End Sub
Dim x%
x = Sheets.Count
For i = x To 3 Step -1
Sheets(i).Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询