search for a sheet

  • Thread starter Thread starter Lee S.
  • Start date Start date
L

Lee S.

How can I write a macro to search through a workbook to
determine whether a sheet with a specific name exist?
Thanks.
 
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
 
Back
Top