Merge Multiple CSV Files in Excel | Excel VBA Tutorial

Поділитися
Вставка
  • Опубліковано 21 жов 2024

КОМЕНТАРІ • 44

  • @jakeliujakeliu
    @jakeliujakeliu 6 років тому +5

    Looking online all day for this, thank you!

  • @jackiegilliam4944
    @jackiegilliam4944 3 роки тому

    FABULOUS...just what I needed to complete my task! THANKS!

  • @jethrodredge9168
    @jethrodredge9168 3 роки тому

    Good day. Thank you for the video very informative. The macros runs however it does not actually pull in the data from the csv file even though it states it has completed the merge. Any suggestions would be greatly appreciated.

  • @stuartopie7117
    @stuartopie7117 3 роки тому

    Hi Jie, hoping you can help Thanks for the video/script, is there a way I can merge the files and keep the dd/mm/yy date format I received them in? When I merge it assumes US date format

  • @myronpang3228
    @myronpang3228 4 роки тому

    Hi, very informative and thank you for the explanation.
    I have a question: what if my CSV files are not in the same column order and i only want to pull only some data from these CSV files to be merged in a excel table? what i want the macro to do is consolidate those data.
    Looking forward to hear from you!

    • @jiejenn
      @jiejenn  4 роки тому

      If your columns' order are not uniform and you only want to merge few columns, my recommendation is write the VBA in a way that you copy one column at a time so your datasets will match when merging.

  • @shreyabiswas7590
    @shreyabiswas7590 4 роки тому +1

    How can I put each csv file in different tabs of the excel workbook?

  • @joseantoniorack3783
    @joseantoniorack3783 4 роки тому

    I’m also getting the runtime error 1004. I copied the code exactly from your website and then made the necessary adjustments to my range. Still no idea what’s wrong.

  • @ARJUNSINGHRAWAT
    @ARJUNSINGHRAWAT 3 роки тому

    wonderful

  • @ParagShah1979
    @ParagShah1979 6 років тому

    Hello,
    Thank you for sharing the useful video on csv merge files.
    I have a query here, as you are merging these csv files in the excel file where you have written the macro code. We have some different requirement where we want to store all the merged csv files in new excel file which we want to share it with stakeholder. so the output of merged csv file should contain only the data and not with the macro code.
    I hope you understood my requirement and will share the output .
    Thanks,
    Parag

    • @jiejenn
      @jiejenn  6 років тому

      Hi. I have done something similar in the past where you take a master excel workbook and create individual files based on a giving list. Unfortunately I currently don't have any tutorial video showing how to do that but I am planning to do one in the future.

  • @danielbosco7487
    @danielbosco7487 5 років тому

    Thanks for the great video! I am having an issue with my code. My implementation is a little different (I am loading file locations from a table in a different sheet) and I keep getting a run time error:
    "1004" on ".Range("A2:N" & last_row).Copy"
    Any thoughts? Thanks.

    • @jiejenn
      @jiejenn  5 років тому

      Looks like VBA can't find your reference source. I don't think I'm able to help with just one line of code provided.

  • @adriannip8677
    @adriannip8677 4 роки тому

    Hey Jay, I have the same issue as multiple people in the comments about the csv file not being found. I sent you an email with my script. Could you take a look at it for me?

    • @jiejenn
      @jiejenn  4 роки тому

      Usually when that happens, it is usually due to typos in the script. I'm currently busy with few projects and other things. My suggestion is to post your problem on ExcelForum.com and you should be able to find help.

  • @jayeshgaikwad3357
    @jayeshgaikwad3357 4 роки тому

    i having some problem while runnign this vba code, im getting this error-run time error '1004', we couldn't find (xyz.csv).it is possible it was moved, renamed or deleted?. but not any issue is my folder path.... how to fix it. pl give the solution this query.thanks.

    • @jiejenn
      @jiejenn  4 роки тому

      Check for typo in your script.

  • @oluwaniyiropo37
    @oluwaniyiropo37 3 роки тому

    For those getting run time error or csv fine has been renamed or removed, kindly follow the process below
    Step 1 : Ensure that you save the excel master file as a macro-enabled file in the multiple csv files path directory.
    step 2: ensure that you change the file path by copying and pasting the new file path from your computer.
    step 3: ensure that you change the column range e.g A2: P

  • @arka2301
    @arka2301 4 роки тому

    When I try to run this code I get an error ‘Sorry we couldn’t find “filename.csv”. Is it possible it was moved, renamed or deleted?”
    The files are in its place neither it has been moved nor deleted.
    Please advise what could be the reason.

    • @jiejenn
      @jiejenn  4 роки тому

      Check your file path. Most likely your script couldn't locate the file.

    • @ravindrabisht7372
      @ravindrabisht7372 4 роки тому

      Same issue here

    • @oluwaniyiropo37
      @oluwaniyiropo37 3 роки тому

      For those getting run time error or csv fine has been renamed or removed, kindly follow the process below
      Step 1 : Ensure that you save the excel master file as a macro-enabled file in the multiple csv files path directory.
      step 2: ensure that you change the file path by copying and pasting the new file path from your computer.
      step 3: ensure that you change the column range e.g A2: P

  • @Daniel-pt4bz
    @Daniel-pt4bz 5 років тому

    I am also getting a Run Time Error 1004 referencing the line >> Set wbTemp = Workbooks.Open(Files)

    • @jiejenn
      @jiejenn  5 років тому

      Makes sure your file name or path is correct.

  • @adrianus13
    @adrianus13 4 роки тому

    Hi Jie, im hoping you can help. I got the script to run initially. But now get errors. The environment is on my computer's local drive (both the macro file and the csv files). The folder for the csv files is in the same folder that the macro file is in. I changed the FolderPath to the csv files folder and included the backslash at the end, and I changed the columns from N to Z in both locations. The error i keep getting is "Run-time error '1004' Sorry, we couldnt find nameofcsv.csv. Is it possible it was moved, renamed or deleted?" When I debug it highlights Set wbTemp=Workbooks.Open (Files). Hovering over that it seems to see my file...so I dont know where to go from there

    • @jiejenn
      @jiejenn  4 роки тому

      Can you send me your script to UA-cam@LearnDataAnalysis.org and I'll take a look at it.

    • @joseantoniorack3783
      @joseantoniorack3783 4 роки тому

      I had the same issue. How did he resolve it?

    • @oluwaniyiropo37
      @oluwaniyiropo37 3 роки тому

      For those getting run time error or csv fine has been renamed or removed, kindly follow the process below
      Step 1 : Ensure that you save the excel master file as a macro-enabled file in the multiple csv files path directory.
      step 2: ensure that you change the file path by copying and pasting the new file path from your computer.
      step 3: ensure that you change the column range e.g A2: P

  • @heatherhironaka6141
    @heatherhironaka6141 5 років тому +1

    I am also getting the file error, what is the typo?

    • @jiejenn
      @jiejenn  5 років тому

      Can you post your code?

  • @JoseAdilsonJr
    @JoseAdilsonJr 5 років тому +1

    Hi! Thanks a lot for your tutorial! I also was looking for it for hours!
    But unfortunately I am getting one error where the macro can find the csv files to get their names, but at the point where it would import them into the new workbook it says it can't find the file haha.
    The error is: "Run-time error '1004': '111_02_03_2019.csv' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open a file from your list of most recently used files, make sure that the file has not been renamed, moved or deleted."
    As it says the name of the file which I did not specified on the code, I know that the first part of the code is functioning perfectly. It is something about when it tries to open the files!
    Can you help me?

    • @jiejenn
      @jiejenn  5 років тому

      Send me your entire VBA code to test@learndataanalysis.org. I suspect maybe there is a typo somewhere.

    • @JoseAdilsonJr
      @JoseAdilsonJr 5 років тому

      @@jiejenn I've send u! Thank you in advance!

    • @jiejenn
      @jiejenn  5 років тому

      @@JoseAdilsonJr Check your inbox.

    • @Kapucino2
      @Kapucino2 5 років тому +2

      I believe that Dir function returns only the file name, not the entire path. I Think Workbooks.Open(Path & Files) should to the trick. You can use the name only if the files are in the default file location (CurDir - to check this path).

    • @joseantoniorack3783
      @joseantoniorack3783 4 роки тому

      Hey Jose, did he end up fixing your problem? I also have the same issue

  • @manuelgraofabra8562
    @manuelgraofabra8562 4 роки тому

    does anyone know why I am getting each row of data separated by semicolons only in the first Column of the Merge Wks?

    • @mohammedziti
      @mohammedziti 4 роки тому

      i had the issue, to add: Workbooks.Open Files, Local:=True