Deleting Worksheets Based on Multiple Worksheet Criteria

前端 未结 1 1811
一个人的身影
一个人的身影 2020-12-20 08:45

I am continuing to build on macros related to data retrieved from mainframe, similar to what is mentioned in my previous questions.

I am generating a large number of

相关标签:
1条回答
  • 2020-12-20 09:16
    tmp = IndividualWorkSheet.Name  
    If tmp <> "Sheet1" And tmp <> "Criteria" And _
       tmp <> "TemplateSheet" And tmp <> "TemplateSheet2" Then 
          IndividualWorkSheet.Delete     
    End If
    

    Array-based approach:

    Dim arr
    arr = Array("Sheet1", "Criteria", "TemplateSheet", "TemplateSheet2")
    
    If IsError(Application.Match(IndividualWorkSheet.Name, arr, 0)) Then
        IndividualWorkSheet.Delete    
    End If
    
    0 讨论(0)
提交回复
热议问题