PDA

View Full Version : From text file to excel spreadsheet



entwined
08-14-2012, 09:52 PM
Hi troopers,

I have a text file that contains TAB delimited data. Here's a sample contents:

ID[tab]Description[tab]Code[tab]Count
INN.001.36[tab]Titles[tab]NL[tab]1
INN.001.37[tab]Titles[tab]NL[tab]1
INN.001.38[tab]Titles[tab]NL[tab]1
INN.001.39[tab]Titles[tab]NL[tab]3
INN.001.40[tab]Titles[tab]NL[tab]1
INN.001.41[tab]Titles[tab]NL[tab]1
INN.001.42[tab]Titles[tab]NL[tab]1
INN.001.43[tab]Titles[tab]NL[tab]1
INN.001.44[tab]Titles[tab]NL[tab]1
INN.001.45[tab]Titles[tab]NL[tab]1

*[tab] are TAB characters

Now I want the file itself to be converted to an excel file (.xls) so it will look like 4 columns A-D in excel sheet. It should appear in the sheet exactly like the above.

Any help would be very much appreciated. Thanks in advance... :)

jolivanes
08-14-2012, 10:30 PM
With Excel open.
File - open and under "Files of type" select Text Files (prn, txt, csv)
Select the text file in question and select "Tab Delimited"

entwined
08-14-2012, 10:33 PM
Sorry if I didn't explain more but I want a vb code for this so the file will be automatically saved in excel. Thanks much...

snb
08-15-2012, 04:09 AM
Just use your macrorecorder and do what Jolivanes explained.