I am having an issue with a macro I created. Essentially I have a bunch of text files that dump memory data from a server every 15 minutes. I am trying to create a macro that will open those text files into a "import" sheet, run a text to columns to clean it up, go to another sheet "data_log" in the same workbook, insert a column, do a vlook up to match data in column A in Data_log to data in column F (bytes) in the import sheet.

What I am running into is that the macro I've created will import all of the data in the text files to the import sheet, but will put all that data in the same columns, running down the rows, so I am trying to make the macro import one file at a time, do the vlookup, then clear the file contents on the "import" sheet, open the next file, rinse repeat. Its opening the files, but not displaying data, and its not doing the vlookup correctly either. It's only importing one line.

Columns A and B, and rows 1-2 will be static in Data_log, and the data imported to import will always have the same format and be the same columns as far as A for the memory tag and F for the bytes it uses.

Here is the Full Code:

Please Login or Register  to view this content.
I am also trying to get it to use the name of the text file as the heading for each column. I tried using 'Range("C2").Select = oFile.Name but its not working correctly.

Here is one of the text files. The formats will be the same just the data will change. The way it appears below is copied directly from the text file. It doesn't import that way into excel which is why I have the text to columns part.

Please Login or Register  to view this content.
I had to shorten the text file data since its more then 10000 characters, but the data takes 1093 roles.
I am ok with formulas, and some scripting, but am just getting into VBA.