Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Created August 1, 2017 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/463b804e8125987bb905606a597a99df to your computer and use it in GitHub Desktop.
Save ndthanh/463b804e8125987bb905606a597a99df to your computer and use it in GitHub Desktop.
Function SheetExists(shtName As String, Optional wb As Workbook) As Boolean
Dim sht As Worksheet
If wb Is Nothing Then Set wb = ThisWorkbook
On Error Resume Next
Set sht = wb.Sheets(shtName)
On Error GoTo 0
SheetExists = Not sht Is Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment