LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Listing xls files and sheets (excluding Hidden tabs) help

Hi all,

I bow to the wisdom of this group. I have been able to find
information on how to list the xls files and all associated sheet tab
names, but I cannot figure out how to exclude the hidden sheet tabs.
I have created a macro for one of my bosses so he can print all
sheets, but if fails due to the hidden sheets.

here is the code for identifying the file names and sheets:

Sub BooksandSheets()

ScreenUpdating = False
Set wb = Workbooks.Add
Debug.Print wb.Name
Cells(1, 1) = "Workbook"
Cells(1, 2) = "SheetName"
intcounter = 2
Set fs = CreateObject("Scripting.FileSystemObject")
Set FSDir = fs.GetFolder("O:\Accounting\FLTACCTG\Account\Priva te
\Reports\2007\Current Month") ' Change Path
Set folder = FSDir.Files
For Each file In folder
Workbooks.Open Filename:=file.Name, UpdateLinks:=False,
ReadOnly:=True
For Each ws In Worksheets

Workbooks(wb.Name).Worksheets(1).Cells(intcounter, 1) =
file.Name
Workbooks(wb.Name).Worksheets(1).Cells(intcounter, 2) =
ws.Name
For Each SH In Worksheets
If (SH.Visible < True) Then
Workbooks(wb.Name).Worksheets(1).Cells(intcounter, 3)
= "HIDDEN"
Else
Workbooks(wb.Name).Worksheets(1).Cells(intcounter,
3) = "NOT HIDDEN"
End If
Next SH
intcounter = intcounter + 1
Next ws
Workbooks(file.Name).Close False
Next

MsgBox "complete"

End Sub


I tried to differentiate between hidden and not hidden files, but it
ran into an issue when one sheet is hidden, it considers them ALL
hidden.

Any help is appreciated.

Thank you,

Ray

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtoal excluding hidden columns Trevor Excel Worksheet Functions 7 November 25th 08 05:56 PM
Countif excluding hidden rows qh8519a Excel Worksheet Functions 4 September 19th 08 06:22 PM
Excluding formulas in hidden cells? Adam L. Kehl Excel Worksheet Functions 3 April 10th 08 03:35 PM
Sum of a column excluding hidden rows mnwild1 Excel Worksheet Functions 10 June 22nd 07 11:24 PM
listing sheet tabs John Excel Programming 2 July 23rd 04 03:51 AM


All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"