+ Reply to Thread
Results 1 to 9 of 9

Macro to delimit and compile multiple files to one sheet:

Hybrid View

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    MO, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Macro to delimit and compile multiple files to one sheet:

    All,

    This is my first post on here. I've searched for quite a while to see if there is existing information on here to help me and while there's some, I can't seem to get it to work exactly. I have multiple files I'm downloading daily into the following location: \\10.6.1.129\exports\LUNLEV

    All files contain the same column data, come out as a comma delimited file, but have varying rows of information. I tried to attach them to this post but it's considered an invalid file type because it's a download directly from our ERP software. The files are comma delimited though and open fine with excel, you just have to run the delimit program when you open it (see attached images): 1.JPG 2.JPG 3.JPG 4.JPG

    I'd like to be able to run a macro that delimits the data and compiles it into one workbook. Is that possible?

  2. #2
    Registered User
    Join Date
    08-14-2013
    Location
    Yellow Point BC Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro to delimit and compile multiple files to one sheet:

    I have pretty much the very same situation. Have a set of files that contain date extracted from our point of sale that I consolidate into one workbook The number of files varies but they are all in the same location and I use a command line prompt to copy all the files into one and then open it in Excel. All the files need to be in the same location, then open a command line prompt and change to the directory where the files are located. Then enter the following command prompt in order to copy all files into one (I assume that all of the files have a .csv extension, but it can be any and it will work): copy *.csv combined.csv.

    The combined.csv can be any name, it is just the one I choose to use. Hope this helps a little.

  3. #3
    Registered User
    Join Date
    08-14-2013
    Location
    MO, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to delimit and compile multiple files to one sheet:

    Thanks Canuck, I'm still stuck on how to get the files delimited to begin with. The data is comma delimited but the file is not a .csv it's actually a .file. The macro I'm looking for will open all the .files in a location, run the delimiter tool, then combine all the data in one sheet. Right now, I can do the macro recorder to get the code to open and delimit the data but not combine it.

  4. #4
    Registered User
    Join Date
    08-14-2013
    Location
    MO, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to delimit and compile multiple files to one sheet:

    Wanted to post the properties of the types of files we're working with, we open them in Excel but they don't come out of our ERP software as a common Excel file: 5.JPG

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro to delimit and compile multiple files to one sheet:

    Did you read the forum rules ?
    Do not post images, this is an Excel forum; please post sample workbooks instead.



  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro to delimit and compile multiple files to one sheet:

    Did you read the forum rules ?
    Do not post images, this is an Excel forum; please post sample workbooks instead.
    Last edited by snb; 08-15-2013 at 08:37 AM.

  7. #7
    Registered User
    Join Date
    08-14-2013
    Location
    MO, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to delimit and compile multiple files to one sheet:

    The files in question aren't excel files, and the filter on these forums wouldn't let me attach them because it didn't recognize the structure. That's why I posted the images to show the "type" of files I was dealing with. I really don't have an Excel sheet to post, the only code I have is the macro recording to open and delimit one of the files but I need to be able to open/delimit/and combine all the files in the target location:


    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        ChDir "\\10.6.1.129\exports\LUNLEV"
        Workbooks.OpenText Filename:="\\10.6.1.129\exports\LUNLEV\ARNO", Origin:= _
            437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
            ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
            Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array( _
            3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10 _
            , 1), Array(11, 1), Array(12, 1)), TrailingMinusNumbers:=True
    End Sub

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro to delimit and compile multiple files to one sheet:

    You can always zip a file to post it here.

  9. #9
    Registered User
    Join Date
    08-14-2013
    Location
    MO, USA
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to delimit and compile multiple files to one sheet:

    Thanks for the tip, I attached the two files below. The excel sheet is where I'd like to compile the data into, on the second tab. The zip folder contains one of the reports being downloaded daily. I'd like to be able to use a macro that opens/delimits/and imports the data from multiple reports at the following location: \\10.6.1.129\exports\LUNLEV

    Thanks again for the quick replies.


    BELL.zip STOCKOUT TRACKER.xlsx
    Last edited by llunde3; 08-15-2013 at 10:41 AM.

+ 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 Compile Data from Multiple files in folder
    By lasjbp9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2013, 08:41 AM
  2. Compile Error - Importing multiple CSV files via GetOpenFilename
    By lgjmac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2013, 08:48 AM
  3. Count data meeting certain criteria from multiple files and compile into Summary
    By Kettie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2013, 12:30 PM
  4. Compile worksheets from multiple files into one workbook
    By derekcosta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2011, 07:34 PM
  5. Renaming files macro - Compile Error
    By JasHogan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2010, 06:51 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