Test or check if sheet exists

后端 未结 22 2985
深忆病人
深忆病人 2020-11-21 23:51
Dim wkbkdestination As Workbook
Dim destsheet As Worksheet

For Each ThisWorkSheet In wkbkorigin.Worksheets 
    \'this throws subscript out of range if there is not         


        
22条回答
  •  猫巷女王i
    2020-11-22 00:14

        For Each Sheet In Worksheets
        If UCase(Sheet.Name) = "TEMP" Then
        'Your Code when the match is True
            Application.DisplayAlerts = False
            Sheet.Delete
            Application.DisplayAlerts = True
        '-----------------------------------
        End If
    Next Sheet
    

提交回复
热议问题