Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing multiple text files to worksheets josnah[_3_] Excel Programming 4 June 3rd 06 11:44 AM
Importing XML files into individual worksheets PabloB Excel Discussion (Misc queries) 0 April 24th 06 06:12 PM
How do I separate worksheets in a workbook into individual files? jmd Excel Worksheet Functions 3 December 13th 05 09:18 PM
Help importing text files into individual cells saybut Excel Discussion (Misc queries) 4 May 31st 05 03:24 PM
Importing multiple text files into single workbook Steve[_56_] Excel Programming 1 January 15th 04 08:18 PM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"