View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
akafrog18 akafrog18 is offline
external usenet poster
 
Posts: 3
Default Table of Contents for Excel File

I have a workbook with 72 worksheets in it. There is a combination of
worksheets used for last year (2006) and this year (2007). Last year
I when I created this file I used the code below in the ThisWorkbook
section of the VBA code. When the workbook was opened it would hide
the other worksheets and just show the Table of Contents for 2006.
Now that we are in 2007 I would like it to show both the 2007 and 2006
Table of Contents. Can someone help me modify this script so it will
show the 2007 also.

Thanks

Private Sub Workbook_Open()
Dim c As Worksheet
For Each c In Sheets
If c.Name < "Table Of Contents - 2006" Then
c.Visible = False
Else: c.Visible = True
End If
Next c
End Sub