Using a Function to Check for the Existence of a Code Name
Function WorksheetCodeNameExists(wb As Workbook, sCodeName As String) As Boolean
Dim s As String
Dim ws As Worksheet
WorksheetCodeNameExists = False
For Each ws In wb.Worksheets
If StrComp(ws.CodeName, sCodeName, vbTextCompare) = 0 Then
WorksheetCodeNameExists = True
Exit For
End If
Next
Set ws = Nothing
End Function
Related examples in the same category