View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Need to merge 1500 files into 1!!!

Try something like the following code:

Sub MergeFiles()
Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Temp" '<<< CHANGE
ChDrive FOLDERNAME
ChDir FOLDERNAME

Set Dest = Range("A1")
FName = Dir("*.xls")

Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets(1).Rows(2).Copy Destination:=Dest
WB.Close savechanges:=False
Set Dest = Dest(2, 1)
FName = Dir()
Loop
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"rglasunow " wrote in
message ...
I currently have 1500 different Excel files from a survey. The

top row
contains the question and the 2nd row contains the answers.

What I
would like to do if find a way to take the information in the

2nd row
of each file and dump it into one spreadsheet.

I can write a macro to copy paste the information, however, the

files
that I am copying the information from are obviously named

differently
and I am not sure how to tell Excel to paste in the next

available row
only a particular cell.

Is there a way that I could automate this entire process

instead of
opening up each file and copy paste?

Any help in the right direction is greatly appreciated!
Thanks in advance!


---
Message posted from http://www.ExcelForum.com/