+ Reply to Thread
Results 1 to 3 of 3

Macro for .txt to help format for excel conversion

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    186

    Macro for .txt to help format for excel conversion

    So this isn't technically an excel question I suppose but it relates enough to it that I thought I would ask here. I have a file which is similarly formatted to the attached document. It has a thousand+ lines all grouped in sets in a similar mannar, all starting with the Recipient ID and ending with "AD2,END;". I took most of the actual data out and put in the same number of characters of usless data because hte original had sensitive information.

    I am trying to convert it into a meaningful Excel table to manipulate hte data from there but have run into a problem, some of the information for cells is seperated by a tab while others is seperated by a return. It happens in a predictible order which I think could be solved by a macro. That is what I am looking for help with.

    It seems like the first return after the begning of each data set should only be a tab, following this the next return is ok, the third should be a tab and so on. Basically every other return should be a tab to make the document convert into an excel table that is usable.

    So can any1 help me out, is there a way to right code to manipulate the text file to achieve this or am I stuck with a .txt file that does me no good?

    thanks

    sample.txt

  2. #2
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Macro for .txt to help format for excel conversion

    Here is a code that will convert your txt file to excel and open it.

    Please Login or Register  to view this content.
    Use the record macro feature to capture your editing decisions, if you need more help let me know!

  3. #3
    Forum Contributor
    Join Date
    05-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    186

    Re: Macro for .txt to help format for excel conversion

    I know how to convert it into excel. I can just open the txt with excel and it will walk through hte conversion at the very least. The isssue is the conversion itself. The way I get the file is not condusive to excel and every month it is different so a record macro won't help all that much.

    I am trying to manipulate the text file so when it imports it is fixed. The problem is it has thousands of lines which manually changing isn't really an option. The text file is also slightly different each month because patient visits are different.

    I am just unfamiliar with setting up something to look for a specific string, start a task until it finds another string then start over at the beggining.
    Last edited by smls; 06-29-2012 at 02:47 PM.

+ 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