LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to Automate Text Import for Multiple Files

I searched and this seemed a topic that came up a lot, but as I'm a
complete newbie at macros I couldn't quite grasp what changes I needed
to make in order to adapt a macro such as Pearson's for my use.

What I have...a folder with 50 or so files that I currently open one
by one with the text import wizard.
What I need to do...I need to open each of those files with tab &
space delimiters, copy certain contents (always cell C32 to the end of
the data in column C), and paste it in a new workbook. Each
subsequent set of copied data would be pasted in the next column in
the new workbook.

I tried recording a macro as I imported one of these files, copied the
desired cell range, and pasted it in a new workbook, but that's as far
as I got. Here is the code for what I've done so far:

Sub Macro2()
'
' Macro2 Macro
'

'
ChDir _
"TestDiretory"
Workbooks.OpenText Filename:= _
"TestDirectory/TestFile" _
, Origin:=437, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True,
Semicolon:=False, _
Comma:=False, Space:=True, Other:=False,
FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1)),
TrailingMinusNumbers:=True
Range("C32").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
End Sub

Thoughts on what to do next? First, I need it to open all the folders
in a given directory and second I need it to paste each copied column
of data into the next column over in the new workbook. Thank you
greatly for any help you can provide and for having patience with such
a novice.

 
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
Import multiple text files (Macro) Thr33of4 Excel Discussion (Misc queries) 0 September 19th 06 02:19 AM
Import of Multiple Text Files yanks6rule[_2_] Excel Programming 1 January 26th 06 11:34 PM
Need to import multiple files with a macro HatTrick Excel Programming 0 August 5th 04 03:57 PM
Import multiple text files into excel Wally Steadman[_2_] Excel Programming 1 November 15th 03 04:14 PM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM


All times are GMT +1. The time now is 08:12 AM.

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"