LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
luis
 
Posts: n/a
Default HELP: Import several TXT files into Excel

Dear all,

I need to import 100 TXT files into a single excel file for my Ph. D.
Dissertation.
All the files have the same structu only 1 column with 60 rows each,
like this:

01 - I
02 - C
03 - C
60 - I

I'd need to end up with an excel file that included 250 columns, one
for each file, and the name of the corresponding file on top of each
column, like this:

File1 File2 File100
01 - I 01 - C 01 - C
02 - C 02 - I 02 - I
03 - C 03 - C 03 - I
60 - I 60 - C 60 - I

I have little Excel experience, but I know how to paste code into a
module in the Visual Basic Editor. Please find below the code I get if
I import 1 single file into my Excel Workbook, in case it helps.

YOUR HELP WILL BE GREATLY APPRECIATED!!!

THANK YOU!!!!!!!!!!!!!!!!!!!!! ;-D

Luis

*** CODE AFTER IMPORTING 1 TXT FILE ***

Sub importTextFile()
'
' importTextFile Macro
' Macro recorded 08/04/2006 by luis cerezo ceballos
'

'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\aaqpresults\cerezo-int2-dah38-exp-rel.txt",
Destination:=Range("A1") _
)
.Name = "cerezo-int2-dah38-exp-rel"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub

 
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
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
problem with import files by excel macro Raven Excel Discussion (Misc queries) 0 January 20th 06 08:23 AM
Excel Files Acting Weird Anat Excel Discussion (Misc queries) 0 March 29th 05 03:07 AM
sharing/using/saving Excel 2002 files in Excel 2003 maze2009 Excel Discussion (Misc queries) 0 January 20th 05 07:27 PM


All times are GMT +1. The time now is 02:26 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"