Last active
December 16, 2015 07:39
-
-
Save mrowles/5400681 to your computer and use it in GitHub Desktop.
Microsoft Excel: This function checks if a Worksheet exists by accepting a Worksheet name as a parameter and looping through available worksheets. It will return false if the name is not found, otherwise it will return true if a Worksheet with the passed parameter exists. It is case-insensitive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function WorksheetExists(wsName As String) As Boolean | |
Dim ws As Worksheet | |
Dim found As Boolean | |
found = False | |
wsName = UCase(wsName) | |
For Each ws In ThisWorkbook.Sheets | |
If UCase(ws.Name) = wsName Then | |
found = True | |
Exit For | |
End If | |
Next | |
WorksheetExists = found | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment