search for a sheet

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.
 
P

pfsardella

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top