Test or check if sheet exists

后端 未结 22 2858
深忆病人
深忆病人 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条回答
  •  不要未来只要你来
    2020-11-22 00:21

    I wrote this one:

    Function sheetExist(sSheet As String) As Boolean
    On Error Resume Next
    sheetExist = (ActiveWorkbook.Sheets(sSheet).Index > 0)
    End Function
    

提交回复
热议问题