macro to read and sort data from multiple text files

J

jsinghprof1

Hello there !!

I have x number of ascii text files that have space delimited data
columns (files may have 3 to 40 data columns). There are about 25
header rows at the top of each file but I am not going to use info
from these rows. I also have a master.xls file. Could someone please
help me create a macro to do the following -

A) read first *.txt file from the given folder into sheet1 of the
master.xls file.

NOTE: I have already set up the sheet2 of the master.xls to sort
required rows of data from sheet1 (based on row headers) using vlookup
to populate a 40 column wide array.

B) Copy the sorted array of cells from sheet2 that have numbers in
them (since the number of columns in the text files vary, I may have
cells in sheet2 that have #REF! in them if the number of columns to be
read from sheet1 are less than 40) and paste (values only) into sheet3

C) clear the contents of sheet1

D) repeat (A) for second *.txt file

E) Copy the sorted array of cells from sheet2 that have numbers in
them and paste (values only) into sheet3 appending to the right of the
columns that were already in sheet3

F) repeat (D) and (E) untill all the *.txt files have been read

thanks!!

jkagg
 

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