View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default How to test to see if a given sheet from is in a workbook from ano

here is some code to let you know if a sheet exist in a workbook

Public Function SheetExists(SName As String, _
Optional ByVal Wb As Workbook) As Boolean
'Chip Pearson
On Error Resume Next
If Wb Is Nothing Then Set Wb = ThisWorkbook
SheetExists = CBool(Len(Wb.Sheets(SName).Name))
End Function

You can pass it a workbook object to test or if you do not speify then it
looks at the workbook that is running the code...
--
HTH...

Jim Thomlinson


"dajns" wrote:

I have 200 workbooks that are 80% the same. One worksheet in each is an index
that has checkboxes for printing. I need to verify the presence of the sheet
to print before I issue the print command. Any sugguestions?