The following should do as you require. Note that you will need to set the folder to look in appropriately.
This code should be placed into a module in the VBE.
Option Explicit
Sub Get_the_rows()
Const FOLDER_TO_LOOK_IN = "C:\My Excel Files"
Dim Input_Path As String, Input_File As String
Dim Output_Row As Long
Dim input_wb As Workbook, input_ws As Worksheet
Dim oldCalcMethod As Long
If Right(FOLDER_TO_LOOK_IN, 1) <> "\" Then
Input_Path = FOLDER_TO_LOOK_IN & "\"
Else
Input_Path = FOLDER_TO_LOOK_IN
End If
Application.ScreenUpdating = False
oldCalcMethod = Application.Calculation
Application.Calculation = xlCalculationManual
With Worksheets(1)
Output_Row = .UsedRange.Rows.Count + 1
If Output_Row = 2 And WorksheetFunction.CountA(.Rows(1)) = 0 Then Output_Row = 1
Input_File = Dir(Input_Path & "*.xls")
Do While Input_File <> "" And Output_Row < .Rows.Count
On Error Resume Next
Set input_wb = Nothing
Set input_wb = Workbooks.Open(Input_Path & Input_File)
If Not input_wb Is Nothing Then
Set input_ws = Nothing
Set input_ws = input_wb.Worksheets("Sheet1")
If Not input_ws Is Nothing Then
input_ws.Rows(2).Copy Destination:=.Rows(Output_Row)
Output_Row = Output_Row + 1
End If
End If
input_wb.Close savechanges:=False
Input_File = Dir()
On Error GoTo 0
Loop
End With
Application.ScreenUpdating = True
Application.Calculation = oldCalcMethod
MsgBox "Complete"
End Sub
Bookmarks