1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

copy multiple files into different sheets

Discussion in 'VBA Macros' started by Rodrigues, Jul 7, 2017.

  1. Rodrigues

    Rodrigues Member

    Messages:
    159
    Hi There
    I would like to copy data from different files into a individual sheets on a daily "master" file, without to have to open the source files using vba, in the easier and simplest way possible.

    Example:
    Folder C:\PA

    25 CSV files from 2017-07-04 Batch Yield Report 0000-0059 until 2300-2359

    (some source files examples):
    2017-07-04 Batch Yield Report 0000-0059
    2017-07-04 Batch Yield Report 0100-0159
    2017-07-04 Batch Yield Report 0600-0659
    2017-07-04 Batch Yield Report 2200-2259
    2017-07-05 Batch Yield Report 2300-2359 (last one and has next day date, however the data belongs to the previous day (4th), so needs to be copied with all of 4th date files too.

    The data on each file needs to be pasted on each individual sheet on "daily master" file
    2017-07-04 Batch Yield Report 0000-0059 (first file) - Sheet1
    2017-07-04 Batch Yield Report 0100-0159 - sheet2... and so on
    2017-07-05 Batch Yield Report 2300-2359 (last file) - sheet25
    I'm currently running loop directory but only copy the data into sheet1 and for whatever reason when past the date onto column B (master file) changes the date format.
    Could someone please help.
    attached are some files for better explanation, "master" file shows how do I need the data to be pasted.
    Thanks in advance.
    R

    Attached Files:

  2. Monty

    Monty Well-Known Member

    Messages:
    833
  3. Rodrigues

    Rodrigues Member

    Messages:
    159
    Monty
    Thank you so much for your help.
    It comes up with syntax error on
    Code (vb):
    If .Show <> -1 Then GoTo AllGood
                DirPath = .SelectedItems(1) & "\"
    Could you please help me?
    Thanks again.

    Attached Files:

Share This Page