View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Damien McBain[_3_] Damien McBain[_3_] is offline
external usenet poster
 
Posts: 28
Default Test for the existence of a worksheet?

Dave Peterson wrote:

It looks like Chip Pearson's.

Stefi wrote:

Not my invention, I found this function in this forum, but I forgot the
author's name, sorry!

Function SheetExists(Sh As String, _
Optional wb As Workbook) As Boolean
'-----------------------------------------------------------------
Dim oWs As Worksheet
If wb Is Nothing Then Set wb = ActiveWorkbook
On Error Resume Next
SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing)
On Error GoTo 0
End Function


Thanks y'all :)