Import several txt files into separate sheets within 1 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, are very large, and the names of the files are generated from the other system. I have code (from the newsgroup - thanks!) that enables me to select the files to be imported: Sub Combine() Dim GetFiles As Variant Dim iFiles As Long Dim nFiles As Long GetFiles = Application.GetOpenFilename _ (FileFilter:="Text Files (*.*),*.*", _ Title:="Select Files To Open", MultiSelect:=True) If TypeName(GetFiles) = "Boolean" Then ''' GetFiles is False if GetOpenFileName is Canceled MsgBox "No Files Selected", vbOKOnly, "Nothing Selected" End Else ''' GetFiles is Array of Strings (File Names) ''' File names include Path nFiles = UBound(GetFiles) For iFiles = 1 To nFiles '' List Files in Immediate Window Debug.Print GetFiles(iFiles) Next End If End Sub But now I don't know how to 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!! |
All times are GMT +1. The time now is 02:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com