+ Reply to Thread
Results 1 to 3 of 3

Convert CSV TXT in separate columns.

  1. #1
    Registered User
    Join Date
    05-02-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Convert CSV TXT in separate columns.

    Hi, I’m new on the forum and has searched the past days to some info about splitting/ converting text string, from a CSV file produced by a datalogger, into separate columns. I found a VBA/macro from WAMP dated 4-20-2010 (Programmatically convert comma separated text to Columns) as one what does the separation and I partly understood the code. As result the separated TXT was reproduced into Rows. Although some modifications I couldn’t achieve to get it into columns. Can somebody explain me the code line:

    Selection.Rows(i).Resize(UBound(splitValues) - LBound(splitValues) + 1).Value = Application.Transpose(splitValues)

    And how to change this one to achieve the result into columns. ( changing Selection.Rows(i) into columns has no effect).

    Attached a (part) example of the datalogger file, an example of the desired output and the above mentioned VBA/ macro.

    I did a lot of Google searches and found that in more than 90% the solutions delivered the output result into separate rows. This gave me the idea that separation into columns is somewhat special.

    I’m looking for a VBA/macro solution because the the datalogger produces daily a file with a lot of TXT lines.

    Thanks in advance for some help and guidance.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Convert CSV TXT in separate columns.

    Excel should open .CSV files and automatically split the comma separated values into different columns...But the data/headers have to start on row 1.

    This will obviously create problems with your dates and times but that can be easily remedied.
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    05-02-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Convert CSV TXT in separate columns.

    Thanks for the response. As far I have expierenced above suggestion is not applicable to Excel2003 or the CSV files structure from the datalogger are different. Have in the mean time found the solutions ( found and modified 2 macro's combined ).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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