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: 9,101
Default copy data to one file from all files

The code below will open ALL files in the directory FOLDER. Then copy the
data on Sheet1 E1:I1 to the next row in the workbook where the macro is run.
Change FOLDER and sheet Names as required.


Sub GetData()

Folder = "C:\temp\"

Set NewSht = ThisWorkbook.ActiveSheet
RowCount = 1

FName = Dir(Folder & "*.xls")
Do While FName < ""
Set bk = Workbooks.Open(Filename:=Folder & FName)
bk.Sheets("Sheet1").Range("E1:I1").Copy _
Destination:=NewSht.Range("E" & RowCount)
bk.Close savechanges:=False
RowCount = RowCount + 1
FName = Dir()
Loop
End Sub

"TFMR" wrote:

Hi All,

I have 50 excel files in folder I want to copy e1,f1,g1,h1,i1 to one new
file against file name. In new excel file in a column files name until 50 and
e1 the first file's data, e2 to i2 2nd files data and so on till 50 files.

Thanks

 
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
copy several files into one file Raul Sousa Excel Programming 1 April 22nd 08 10:44 PM
Copy worsheet from different files in to one file Boss Excel Programming 1 April 14th 08 11:42 AM
use macros to copy and paste from 1 file to several files Joy Excel Worksheet Functions 0 March 5th 08 07:08 AM
Copy worsheet from different files in to one file Boss Excel Programming 3 February 11th 08 01:06 PM
How do I pull data from multiple files and copy into one file JT Excel Programming 2 May 3rd 05 07:42 PM


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

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

About Us

"It's about Microsoft Excel"