Consulting

Results 1 to 19 of 19

Thread: Solved: Combine multiple workbooks from various locations into one master workbook

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location

    Solved: Combine multiple workbooks from various locations into one master workbook

    I'm trying to modified this code below but no luck. What I'm trying to do is to combinde multiple workbook into one master workbook. These files are from multiple file paths its suppose to open the last modified file in those folders and grab all the worksheets in those workbooks and insert all the worksheets into the master workbook. So the master workbook could have about 9 worksheets in total.

    Does anyone has any ideas how to go about this?

    I aslo found this code. Its by DRJ it almost does everything what I'm after. But can it be modified to open the last modified files from those various locations?

    http://www.vbaexpress.com/kb/getarticle.php?kb_id=221



    [VBA] Sub Combine_MultipleFiles()
    Dim Wkb As Workbook
    Dim i As Integer
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    With Application.FileSearch
    .NewSearch
    .LookIn = "Z:\Performance\Daily Data\Sample\"
    .LookIn = "Z:\Performance\Daily Charts\Test\"
    .LookIn = "Z:\Maker\"
    .LastModified = msoLastModifiedToday
    .SearchSubFolders = IncludeSubFolders
    .FileType = msoFileTypeExcelWorkbooks
    If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
    ReDim strFilelist(.FoundFiles.Count)
    For i = 1 To .FoundFiles.Count
    Set Wkb = Workbooks.Open(.FoundFiles(i))
    WS.Copy after:=OWB.Worksheets(OWB.Worksheets.Count)
    Wkb.Close SaveChanges:=False
    Next i
    End If
    End With
    Application.EnableEvents = True
    Application.ScreenUpdating = True

    End Sub
    [/VBA]
    Last edited by Shazam; 02-02-2006 at 03:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •