You are on page 1of 1

1 Sub simpleXlsMerger() 

2 Dim bookList As Workbook


3 Dim mergeObj As Object, dirObj As Object, filesObj
4 As Object, everyObj As Object
5 Application.ScreenUpdating = False
6 Set mergeObj =
7 CreateObject("Scripting.FileSystemObject")
8
9 'change folder path of excel files here
10 Set dirObj =
11 mergeObj.Getfolder("D:changetoexcelfilespathhere")
12 Set filesObj = dirObj.Files
13 For Each everyObj In filesObj
14 Set bookList = Workbooks.Open(everyObj)
15
16 'change "A2" with cell reference of start point
17 for every files here
18 'for example "B3:IV" to merge all files start from
19 columns B and rows 3
20 'If you're files using more than IV column, change
21 it to the latest column
22 'Also change "A" column on "A65536" to the same
23 column as start point
24 Range("A2:IV" &
25 Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate

'Do not change the following column. It's not the


same column as above
Range("A65536").End(xlUp).Offset(1,
0).PasteSpecial
Application.CutCopyMode = False
bookList.Close
Next
End Sub


Change the folder as mentioned on comment
on the macros code

You might also like