Results 1 to 1 of 1

VBA Open and Copy From Multiple Files

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Open and Copy From Multiple Files

    Hi, I wonder whether someone may be able to help me please.

    I'm trying to put together a script which performs the following function:

    [LIST]Create a dialog box which allows the user to select a folder and automatically open multiple 'Source' files which all have the password of "Master".[/LIST]
    • From each 'Source' file, open the sheet called "Input" start at row 2 and copy from columns A:L down to the last used row. Then close each 'Source' file.
    • Paste the data from each 'Source' file to the sheet "All Data" contained with the 'Destination file where the macro is being run from, pasting the rows of data one under another in columns B:M starting at row 5

    I've managed to put together the first part which allows the user to select the folder and open the files which is as below:

    Sub OpenMultipleFilesFromFolder2()
         
        Dim fPath As String, mName As String, fName As String
         
        fPath = "C:Reporting\Chris Test\"
        mName = InputBox(Prompt:="Please Type Month Name", Title:="Month Folder")
        If mName = vbNullString Then
            MsgBox "Missing Month Info"
            Exit Sub
        End If
         
        fPath = fPath & "\" & mName & "\"
        fName = Dir(fPath & "\*.xls*")
        Do While fName <> ""
            Workbooks.Open Filename:=fPath & "\" & fName
            fName = Dir
        Loop
         
    End Sub
    But I'm having a little difficulty in incorporating the password which would allow the files to open automatically, and I'm unsure how to put together the copy and paste functionality.

    I just wondered whether someone could possibly look at this please and offer some guidance on how I may go about achieving this.

    Many thanks and kind regards
    Last edited by hobbiton73; 10-08-2013 at 03:12 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open Multiple Files, Copy Worksheet, Paste in to Specific Tab in Original Workbook
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2013, 10:27 AM
  2. Replies: 0
    Last Post: 04-13-2013, 10:45 AM
  3. Open all xls Files in folder & Copy To 1 Spreadsheet
    By Tyler_Durden in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-12-2011, 05:46 AM
  4. Open a file and copy data into multiple files
    By ncduke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2010, 09:39 AM
  5. A Macro to open 2 linked files copy 3rd files Input sheet
    By barrha0b in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2010, 09:53 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1