Hi Arlu,
Thanks for your quick responce but
I am geting compilation error msg 9 at bold section can u please check and reply me as i am seeing u r online this time.
Option Explicit
Sub cons_data()
Dim Master As Workbook
Dim sourceBook As Workbook
Dim sourceData As Worksheet
Dim CurrentFileName As String
Dim myPath As String
Application.ScreenUpdating = False
'The folder containing the files to be recap'd
myPath = "C:\Score"
'Finds the name of the first file of type .xls in the current directory
CurrentFileName = Dir(myPath & "\*.xlsx")
'Create a workbook for the recap report
Set Master = ThisWorkbook
Do
Workbooks.Open (myPath & "" & CurrentFileName)
Set sourceBook = Workbooks(CurrentFileName)
Set sourceData = sourceBook.Worksheets(1)
With sourceData
.Range("A2:B2").Copy Master.Worksheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End With
sourceBook.Close
'Calling DIR w/o argument finds the next .xlsx file within the current directory.
CurrentFileName = Dir()
Loop While CurrentFileName <> ""
MsgBox "Done"
Application.ScreenUpdating = True
End Sub
Bookmarks