Converting text file to excel file macro - help needed

I have a text file I need to convert to an excel spreadsheet. I wouldn't have a problem making an array code if it were a straight file but the trick is that each line could be different.

For example:

Line one is

01330948951000312 eeid jan boerenkamp

line 2 is

023330948951000312 00370058274800350010112/01/2002

Line 3 is

05330948951000312 31065327123107533811

any time a line begins with 01 it will follow that format

any time a line begins with 02 it will follow the format of line 2 and so on

Is there a way to make an array to put into Excel so that if a line starts with 01 it splits it one way and if a line begins with 02 it splits another way and so on

Thanks in advance



Answer this question

Converting text file to excel file macro - help needed

  • RayClark096

    Hello Mary,

    How do you want the lines split into excel, eg should line 1 be split into three columns, line 2 into two columns

    or should they be split into rows

    Chas


  • Chris Honcoop

    You could try the Text Import Wizard:

    - File - Open -files of type: text files and then in the wizard - delimited - delimiters: space and set the column
    data format of any columns containing numbers beginning with zero as text.

  • Converting text file to excel file macro - help needed