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