L Lee S. Sep 12, 2003 #1 How can I write a macro to search through a workbook to determine whether a sheet with a specific name exist? Thanks.
How can I write a macro to search through a workbook to determine whether a sheet with a specific name exist? Thanks.
P pfsardella Sep 13, 2003 #2 And another take, ......... If WorksheetExists("YourSheetName") Then ' Do your thing. Public Function WorksheetExists(WSName As String) As Boolean '' Checks to see whether a WorkSheet exists. On Error Resume Next WorksheetExists = Len(Worksheets(WSName).Name) > 0 End Function HTH Paul
And another take, ......... If WorksheetExists("YourSheetName") Then ' Do your thing. Public Function WorksheetExists(WSName As String) As Boolean '' Checks to see whether a WorkSheet exists. On Error Resume Next WorksheetExists = Len(Worksheets(WSName).Name) > 0 End Function HTH Paul