Answers for "excel vba test if worksheet exists"

VBA
0

excel vba test if worksheet exists

Function WorksheetExists(pShtName As String, Optional pWb As Workbook) As Boolean
    Dim sht As Worksheet

  If pWb Is Nothing Then Set pWb = ThisWorkbook
    On Error Resume Next
    Set sht = pWb.Sheets(pShtName)
    On Error GoTo 0
    WorksheetExists = Not sht Is Nothing
End Function
Posted by: Guest on January-31-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language