View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Table of Contents - Data from unhidden sheets only

Hi,

Try this:

Sub TEST()
Dim ws As Worksheet
Dim i As Long
With ActiveWorkbook
For Each ws In .Worksheets
Select Case True
Case ws.Visible And ws.Name < "Contents"
.Sheets("Contents").Cells(i + 1, 1) = _
ws.Range("A1")
i = i + 1
End Select
Next
End With
End Sub

Regards,
KL

"Scott J. Hamilton" <Scott J. wrote in
message ...
I have a financial planning workbook with 30 sheets. The book has a table
of
contents that is created manually by pulling info from cell A1 of each
sheet.
However, we hide certain sheets depending on the situation. The sheets
that
are hidden in any given situation is unpredictable.

Is there a way to automate pulling data only from the unhidden sheets and
then putting it onto a table of contents page?