ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing multiple text files into single workbook (https://www.excelbanter.com/excel-programming/288080-importing-multiple-text-files-into-single-workbook.html)

Steve[_56_]

Importing multiple text files into single workbook
 
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!!

ianripping[_9_]

Importing multiple text files into single workbook
 
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"


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com