Importing multiple text files into single workbook

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi everyone. I have a folder that receives data dumps from a
different system. The files are text files, contain data on only 1
sheet, and the names of the files are generated from the other system.

I would like a macro that would allow me to select various files
within the same folder, and copy the data into a seperate worksheet
within the same workbook.

So basically, I'd like to choose and consolidate multiple text files
into 1 excel workbook containing many worksheets.

I have very limited knowledge of VBA. Thanks so much!!
 
This should work:-

Sub Macro1()
Workbooks.Open Filename:= "filename.txt"
Selection.Copy
Windows("Book1").Activate
Range("A1").Select
ActiveSheet.Paste
MsgBox ("Complete")
End Sub

Just put the path and filename of "filename.txt" and the current
workbooks name in "Book1"
 
Back
Top