Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
importing multiple text files into individual worksheets in workbook
Hi I've searched through group and haven't quite found an answer for my
use. I have multiple individual text files, that contain simple text. I want to import them into 1 workbook each as a seperate worksheet.Each text file,single column, and each text line as a seperate row in sheet. Thanks Guy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
importing multiple text files into individual worksheets in workbo
Sub ImportFiles()
Dim sPath as String, sName as String Dim bk as Workbook sPath = "C:\MyTextFiles\" sName = dir(sPath & "*.txt") do while sname < "" set bk = workbooks.Open(sPath & sname) bk.worksheets(1).Move After:= _ thisworkbook.worksheets( _ thisworkbook.worksheets.count) sname = Dir() Loop End sub -- Regards, Tom Ogilvy " wrote: Hi I've searched through group and haven't quite found an answer for my use. I have multiple individual text files, that contain simple text. I want to import them into 1 workbook each as a seperate worksheet.Each text file,single column, and each text line as a seperate row in sheet. Thanks Guy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
importing multiple text files into individual worksheets in wo
Tom,
How could you use this to work with delimited data? I have multiple .chr files where the string is delimited by " and the field by , that I'd like to get into individual sheets in one workbook. I tried to mess with your code, but can't figure it out. Thanks! "Tom Ogilvy" wrote: Sub ImportFiles() Dim sPath as String, sName as String Dim bk as Workbook sPath = "C:\MyTextFiles\" sName = dir(sPath & "*.txt") do while sname < "" set bk = workbooks.Open(sPath & sname) bk.worksheets(1).Move After:= _ thisworkbook.worksheets( _ thisworkbook.worksheets.count) sname = Dir() Loop End sub -- Regards, Tom Ogilvy " wrote: Hi I've searched through group and haven't quite found an answer for my use. I have multiple individual text files, that contain simple text. I want to import them into 1 workbook each as a seperate worksheet.Each text file,single column, and each text line as a seperate row in sheet. Thanks Guy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Importing multiple text files to worksheets | Excel Programming | |||
Importing XML files into individual worksheets | Excel Discussion (Misc queries) | |||
How do I separate worksheets in a workbook into individual files? | Excel Worksheet Functions | |||
Help importing text files into individual cells | Excel Discussion (Misc queries) | |||
Importing multiple text files into single workbook | Excel Programming |