Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Path As String
Dim Ext As String
Dim fName As String
Dim sht As Worksheet
Workbooks.Add
With ActiveWorkbook
.SaveAs "MergeExcelFiles"
End With
Ext = ".xls"
Path = "C:\"
fName = Dir(Path, vbNormal)
Do While fName <> ""
If Right(fName, 4) = Ext Then
Workbooks.Open Filename:=Path & fName
With ActiveWorkbook
For Each sht In .Sheets
sht.Range("A1", sht.Range("A1").SpecialCells(xlLastCell)) _
.Copy Workbooks("MergeExcelFiles.xls").Sheets("Sheet2") _
.Range("A" & Workbooks("MergeExcelFiles.xls").Sheets("Sheet2") _
.Range("A1").SpecialCells(xlLastCell).Row)
Next
.Close
End With
End If
fName = Dir
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True