Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lets see if this stumps you. I need some code to list the contents of 1

Status
Not open for further replies.

addicted2

MIS
Jan 16, 2002
16
AU
Lets see how you go here. I need some code that will collect all the worksheet names from several workbooks that reside in serveral subfolders That are in a folder on C: called house hold. Sorry but i can think of no easier way to explain it. If you refer back to my last thread posted 2 days ago hopefully this will clear up any confusion I may have created.

I have a list of all the SubFolders
I have a list of all the xls's that are in these sub folders
now I need to get a list of all the worksheets and place them in the activecell of the activeworkbook.

Msg to Skip.Thanks may little program is in disoray now .joke.. How I hope to get around the duplicates is to add the users intitials when saving. Skip also there will be a seaarch done prior to entry. This search will focus on the lists that WE have been working on.
 
Tony,
Start with your list of...
Code:
Folder    File

A. Make a Pivot Table to summarize the list of Files...
1. Menu Item - Data/Pivot Table and Chart...
2. Where is the data...Option button - MS Excel list or database
3. What kind of report... Option button - PivotTable
4. Next
5. Where is the data... change Range to absolute column reference...$A:$B
6. Next
7. Where do you want to put... Option button - New worksheet
8. Layout
9. Drag File to Row, doubleclick File, select Subtotals - Option button - None OK
10. Drag File (from right) to Data
11. OK - Finish

Now you have a list of unique file names. Whenever the sorce data changes, all you need to do on the sheet with the Pivot Table is Data/Refresh Data.

Hope this helps ;-) Skip,
metzgsk@voughtaircraft.com
 
Here's how to add items to your ListBox from a Pivot table...
Code:
Sub AddListItems()
    For Each PivotTable In ActiveSheet.PivotTables
        For Each PivotField In PivotTable.PivotFields
            Select Case PivotField.Name
                Case "Files"
                    For Each PivotItem In PivotField.PivotItems
                        UserForm1.ListBox1.AddItem PivotItem.Name
                    Next
            End Select
        Next
    Next
End Sub
Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top