vba 删除指定Sheet页

 1 Sub DeleteSheet(filePath)
 2     ' 禁止Excel弹窗
 3     Application.DisplayAlerts = False
 4     Dim wb As Workbook
 5     Dim ws As Worksheet
 6     Set wb = Workbooks.Open(filePath)
 7     For Each ws In wb.Workbooks
 8         If ws.Name = "Sheet1" Then
 9                 ws.Delete
10                 Exit For 
11         End If  
12     Next    
13     wb.Close SaveChanges:=True
14 End Sub    

 

posted @ 2022-08-30 16:01  拷贝达人  阅读(150)  评论(0编辑  收藏  举报