Macro help required for getting data from multiple excel files.

saranyas366

New Member
Joined
Jun 25, 2013
Messages
3
Dear All,

I have 1000s of same structure excel files in a folder.

I want to extract some common details to one single excel file.

Ex. in excel file book1.xls, page a1 relates to name of customer 1, a2 relates to his address, a3 relates his contact number. etc..
As well as in book 2.xls, page a1 relates to name of customer 2, a2 relates to his address, a3 relates his contact number. etc..

I want to extract all these particulars to one single excel page.

I need some expert advice from all of you

Thanks in advance.

Ms. Saranya, Kerala, India
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Dear All,

I have 1000s of same structure excel files in a folder.

I want to extract some common details to one single excel file.

Ex. in excel file book1.xls, page a1 relates to name of customer 1, a2 relates to his address, a3 relates his contact number. etc..
As well as in book 2.xls, page a1 relates to name of customer 2, a2 relates to his address, a3 relates his contact number. etc..

I want to extract all these particulars to one single excel page.

I need some expert advice from all of you

Thanks in advance.

Ms. Saranya, Kerala, India

Hi Saranya,

I guess below code will help you to resolve your issue.

Let me know for any further clarification.

Code:
Sub Consolidation()

Workbooks.Add
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "Reports.xls"
ThisWorkbook.Activate
Range("C6").Select
Do While ActiveCell.Value <> ""


Workbooks.Open Filename:=ActiveCell.Value
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Workbooks("Reports").Activate
ActiveCell.PasteSpecial xlPasteAll
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ThisWorkbook.Activate
ActiveCell.Offset(1, 0).Select
Loop




End Sub

Kindly Enter the path of source files in MacroFile

For Example:
C:\Users\Desktop\Sai\Test1

<tbody>
</tbody>
 
Upvote 0
NameAddress 1Address 2Address 3Address 4Address 5Phone Number
PinsonPADASSERIL HOUSEKAPLIPPARAMUNDUR POSTPalakkad16 kerala9447943121
RAMAKRISHNAN MSREENIVAS'KALLEKKADNEAR AR CAMPPalakkad16-Kerala9497963119
P A ABDUL GAFOORASHIK MANZILKANAYADVADAVANNOOR POPALAKKAD16-KERALA9995280130

<colgroup><col span="6"><col></colgroup><tbody>
</tbody>
 
Upvote 0
Dear Sir,

I tried in VBE...Reports.xls created but one error occured while pressing Run button.

Can you explain with screenshots?

Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,882
Members
449,097
Latest member
dbomb1414

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