Opening multiple txt files into one workbook as separate sheets

T

tbraddy

I have seen posts about opening multiple txt files from a folder and
saving each of them as a separate .xls.

Is there a macro that would open all the .txt or .dat files in the
directory that the .xls resides and put them as a new sheet in that
folders .xls?

IE. Folder1 data1.dat data2.dat Excel.xls

1.After running the macro in Excel.xls in Folder1 it has sheets
data1.dat and data2.dat

2. Then if I move Excel.xls to Folder 2 with data3.dat and data4.dat
and ran the macro again... Excel.xls would have data1.dat data2.dat
data3.dat data4.dat
 
T

tbraddy

Ton,

That works great!

I just needed to change the txt to dat to find the .dat extension.

I believe that it doesn't work if there is a .txt file with no data,
but that won't be the case with my files.

Thanks
Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top