View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mort_Komabt[_2_] Mort_Komabt[_2_] is offline
external usenet poster
 
Posts: 5
Default Check if a worksheet exists

Thanks for that..... It works great

"bpeltzer" wrote:

Function SheetExists(ByRef SheetName As String) As Boolean
Dim ws As Worksheet
SheetExists = False
For Each ws In Worksheets
If ws.Name = SheetName Then SheetExists = True
Next
End Function
HTH. --Bruce

"Mort_Komabt" wrote:

Hi all

I am looking for a way to get VBA to check if a worksheet exists using a
named range as the source and if the sheet does not exist then add the
required sheet name... the only examples I have been able to find use the
following code
If SheetEsists("sheetname") = True Then.

However, this does not appear to be a known function within Excel 2000.....
Is there another way or am I missing something?

Regards and Thanks

Mort_kombat