+ Reply to Thread
Results 1 to 4 of 4

open and consolidate .csv files

Hybrid View

Crispy85 open and consolidate .csv... 08-19-2015, 07:23 AM
Crispy85 Re: open and consolidate .csv... 08-19-2015, 09:18 AM
Crispy85 Re: open and consolidate .csv... 08-20-2015, 04:31 AM
Crispy85 Re: open and consolidate .csv... 08-20-2015, 04:28 AM
  1. #1
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    open and consolidate .csv files

    Hi Everyone,

    I have this following problem.
    I use a macro to open files from a certain folder.

    I would like to do the same with several .csv files.
    The macro does what it does: it searches a folder for files, opens the files, consolidates them in one sheet. No problem.

    However, my output is really strange.
    When i open one of these .csv files manually, everything is correctly divided into the right columns (somehow the semicolon seperator is automatically picked up when i open the file). But when i run the macro it doesn't do the same. So it seems there is a difference in opening the .csv file normal and opening it via the macro.
    It's kinda hard to explain, but because i'm working with some privacy sensitive information, i cannot simply add a .csv file in to this topic.

    I can add the code that i use, maybe someone sees something strange.

            Dim bookList As Workbook
            Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
            Application.ScreenUpdating = False
                Set mergeObj = CreateObject("Scripting.FileSystemObject")
     
                'change folder path of excel files here
            Set dirObj = mergeObj.Getfolder("\\c:\test")
            Set filesObj = dirObj.Files
            
            If filesObj.Count = 0 Then
                MsgBox "No files in folder!"
                Exit Sub
            End If
            
            For Each everyObj In filesObj
            Set bookList = Workbooks.Open(everyObj)
           
            Range("A2:IV" & Range("A65536").End(xlUp).Row).Copy
    
            ThisWorkbook.Sheets("Consolidate").Activate
     
            Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
            Application.CutCopyMode = False
            bookList.Close
            Next

  2. #2
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: open and consolidate .csv files

    I created a sample file for the people who want to try and open the type of .csv file that i'm using.
    I hope someone can help!
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: open and consolidate .csv files

    I think i now found what happens. Whenever i open the .csv file normally it uses ; as a delimiter as it should.
    But whenever i open the file thru the macro, it uses , as a delimiter.
    Does someone know where i can change this , to ; so that the macro will use ; as a delimiter too?

  4. #4
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: open and consolidate .csv files

    I would like to bump this, because i've been trying to find a solution anywhere but can't find any
    Please use my script to open and import the .csv file to see the result.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to open files and copy specific sheet into new workbook (have open files part)
    By dangerdavedsp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2015, 02:23 PM
  2. Macro to consolidate data from many files
    By Masa1989 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-15-2015, 07:56 AM
  3. [SOLVED] How to consolidate these files into one output
    By clifford_ayala in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-27-2014, 04:03 AM
  4. How to Join Two Excel Files Consolidate Files
    By danitydazzle in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-07-2014, 06:42 PM
  5. [SOLVED] Open all files in a SharePoint folder (Problem: Files open out of order)
    By holmstarrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 10:13 AM
  6. Consolidate SIMILAR files into one file
    By popvel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2012, 11:25 PM
  7. Open, Convert, Consolidate
    By RAparente in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2008, 01:49 AM

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