|
Sub delsht() Dim wb As Workbook, sht As Worksheet, shtname As String Dim strpath As String, fn As String shtname = Application.InputBox("请输入要删除的工作表名称:", , , , , , 2) strpath = ThisWorkbook.Path & "\" fn = Dir(strpath & "*.xls*") Application.ScreenUpdating = False Application.DisplayAlerts = False Do While Len(fn) If fn <> ThisWorkbook.Name Then Set wb = Workbooks.Open(strpath & fn) For Each sht In wb.Worksheets If Trim(sht.Name) = shtname Then sht.Delete End If Next wb.Close 1 End If fn = Dir Loop Application.DisplayAlerts = True Application.ScreenUpdating = True Set wb = Nothing Set sht = Nothing End Sub |
评分
-
1
查看全部评分
-
|