Combine xls Files

mgpco

New Member
Joined
May 17, 2003
Messages
4
Hi there ,

My question is do u know any sort of program that can combine 100 xls Files (all has only one sheet ) to only one huge file in just one sheet !

and yes all the sheets having same no of columns and rows of data !!


Regards
H.B :)
 
Hi,
I'm trying to merge a lot of excel files into one. I tried using this code but... nothing happens. I mean... I run it and then , what should I do?.
Could you please explain this a bit more ? For noobs like me :).
Thx.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Dear all,
How can we put these excel files into one excel file but in seperate sheets?
Thank you!
 
Upvote 0
Hi Guys,

This site is very useful.The code mentioned in this thread is almost matching my requirement. Can someone tell me how to move only selective records from each excel sheet like for eg. Value in B column = 'S&P'.

Regards,
Kevin
 
Upvote 0
I tried Gnaga's code, and it worked! However, for my data, I need to merge the files such that each file should be copied and pasted to the next blank column (not Row). I've modified Gnaga's code to do this (see below), but it didn't work. Any help would be greatly appreciate:

Sub MergeSheets()

Dim SrcBook As Workbook

Dim fso As Object, f As Object, ff As Object, f1 As Object



Application.ScreenUpdating = False

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.Getfolder("C:\Temp\")

Set ff = f.Files



For Each f1 In ff

Set SrcBook = Workbooks.Open(f1)

Range("A1:IV" & Range("A65536").End(xlToLeft).Column).Copy

ThisWorkbook.Worksheets(1).Activate

Range("IV1").End(xlToLeft).Offset(0, 1).PasteSpecial

Application.CutCopyMode = False

SrcBook.Close

Next

End Sub




You could have used your earlier posting itself.

The following macro will do the job of copying all your data from indvidual workbook and paste into a single sheet.

No error trap is provided.

Copy your all individual workbooks into a single directory "C:\Temp\"
Open a new workbook. Right click the leftmost excel ison and click viewcode then paste this code and run.

Keep backup of your orignal data.


Sub MergeSheets()
Dim SrcBook As Workbook
Dim fso As Object, f As Object, ff As Object, f1 As Object

Application.ScreenUpdating = False
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfolder("C:\Temp\")
Set ff = f.Files

For Each f1 In ff
Set SrcBook = Workbooks.Open(f1)
Range("A1:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
SrcBook.Close
Next
End Sub

GNaga
 
Upvote 0
Dear Gnaga!!
This macro is really fantastic!! Thank you so much.
If it is possible, I would ask you one more thing.
I need to copy ton of excel files and your Macro is fantastic. Nevertheless, for each sheet I need to copy the name of each excel file for all the rows of any specific copied file:
For instance, considering two excel files: FILE1.xls and FILE2. xls

FILE1
a 1
b 4
c 5

FILE2
z 7
e 6
r 2

MERGE

FILE1 a 1
FILE1 b 4
FILE1 c 5
FILE2 z 7
FILE2 e 6
FILE2 r 2


Thank you so much four your help!!
All the best,
volodos



You could have used your earlier posting itself.

The following macro will do the job of copying all your data from indvidual workbook and paste into a single sheet.

No error trap is provided.

Copy your all individual workbooks into a single directory "C:\Temp\"
Open a new workbook. Right click the leftmost excel ison and click viewcode then paste this code and run.

Keep backup of your orignal data.


Sub MergeSheets()
Dim SrcBook As Workbook
Dim fso As Object, f As Object, ff As Object, f1 As Object

Application.ScreenUpdating = False
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfolder("C:\Temp\")
Set ff = f.Files

For Each f1 In ff
Set SrcBook = Workbooks.Open(f1)
Range("A1:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
SrcBook.Close
Next
End Sub</pre>

GNaga
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
Latest member
Mr Hughes

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