Open multiple excel file, get data into a single file

hunza

New Member
Joined
Dec 15, 2010
Messages
2
I have 144 excel files in one folder, their name ranged from 001, 002, 003, .....156 (File names correspond to subject ID, some of the subjects are missing)

I want to get partial data from each file and then paste into a new file to generate a table with three col. like below

FileName (Name of file) SubjectName (Subject name preset in sheet:subject info) TST (Sum of N col of every excel File:sheet:data)


I have already develop a macro which can open & read certain info from single individual excel file and then paste in the single excel file. I need to put in the loop, so it can work with all 144 files as once.

Sub CopyCells()
Workbooks.Open Filename:="D:\Hunza\Data\Munir\Researches\Armband 2010\data\001.xls" 'increment required in file name
ThisWorkbook.Activate
Range("D2").Select 'increment required in D2
ActiveCell.FormulaR1C1 = "=SUM([001.xls]Data!C14)"
Windows("001.xls").Activate 'increment required in file name
Sheets("Subject Info").Select
Range("B1").Copy
ThisWorkbook.Activate
Sheets("sheet1").Activate
'*** Select the destination cell
Range("C2").Select 'increment required in C2
ActiveSheet.Paste
Workbooks("001.xls").Close 'increment required in file name
End Sub

Thanks
Munir
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,226,694
Messages
6,192,473
Members
453,726
Latest member
JoeH57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top