Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Open and copy all workbook sheets in a folder to a master file

Hi,

I have a folder with a changing number of status reports in it. Each is
standardized and only contains one tab, "Status Report".

Each status report has a cell (always B10) categorizing what type it
is.

I then have a "Infra Crit Master" that originally will have one tab
"Summary" also in the folder.

What I would like is every time the master file is opened, it will
search the folder for workbooks where B10 = True on the "Status Report"
tab. It will then make a copy of that worksheet and place this
worksheet after "Summary" in "Infra Crit Proj."

I'm not proficient at VB and cobbled together this piece of code from
other topics:

Private Sub Workbook_Open()
Dim i As Integer, wb As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "\\lm-intm-01\clientdata$\n0148234\Desktop\Status Report"
.SearchSubFolders = False
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count

Set wb = Workbooks.Open(Filename:=.FoundFiles(i))

If (wb.Worksheets("Status Report").Range("B10") = "TRUE") Then
wb.Worksheets("Status Report").copy
After:=Workbooks("Infra Crit Proj").Sheets("Summary")
End If
Next i
End With

End Sub

I understand most of it, but get lost at the actual copying part, not
sure of any of the conventions for refering to workbooks, worksheets,
etc. Suffice to say it doesn't work.

Any help would be greatly appreciated. Thanks!

Reply
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
2 Workbooks and 6 Worksheets - Need to Populate 1 Workbook MichelleS Excel Worksheet Functions 15 October 28th 06 10:26 PM
How to merge monthly workbooks into a quarterly workbook?? erinattbt123 Excel Worksheet Functions 6 September 19th 06 10:56 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
Protect Workbook vs Worksheet?? Dan B Excel Worksheet Functions 3 November 7th 05 09:02 PM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM


All times are GMT +1. The time now is 05:15 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"