Convert text file to excel

tonodelro

New Member
Joined
Feb 12, 2019
Messages
2
Hi! I have various text files I need to download on a quarterly basis and have to manually convert them to excel into a specific table format. How do I go about this with a macro to make my life easier?? THANK YOU IN ADVANCE!

Example of text file:

01 BANCO DE CHILE
1000000 0000017419786,00 0000014615663,00 0000000086976,00 0000003804034,00
1100000 0000000715868,00 0000000000000,00 0000000000000,00 0000000164213,00
1100100 0000000587633,00 0000000000000,00 0000000000000,00 0000000037229,00

I´d need something like this as an output

Column A Column B Column C etc.
01 (without BANCO DE CHILE) 100000017419786



<colgroup><col><col><col span="4"></colgroup><tbody>
</tbody>
¿

The thing is, the text file changes in size and somtimes columns D,E,F come empty. Is it possible to create something dynamic that adapts to the size??

<tbody>
</tbody>
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Welcome to the Board!

Turn on your Macro Recorder, and record yourself opening one of these text files, and using the Import Wizard, choose the appropriate options to convert your file. It looks like you file may be Fixed Width or perhaps Space Delimited. When finished, stop the Macro Recorder, and you should have the code you need to apply to your files as you import them. You can add some File Browser code to the beginning of the Macro, so when you run the Macro, it will allow you to browse to the file, and then it will convert that file.

You should be able to find the File Browser code with a search. If you run into issues, post back here.
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top