Excel – VBA – How can I tell if a specific worksheet exists?

Function WksExists(wksName As String) As Boolean
    On Error Resume Next
    WksExists = CBool(Len(Worksheets(wksName).Name) > 0)
End Function

You can call this function from your code, e.g.:

Msgbox WksExists("Sheet19")

NOTE: you can use the if statement instead of a msgbox, or a common cycle to operate on the existing worksheet.

SOURCE

LINK (Contextures.com)

LANGUAGE
ENGLISH