Dear Gurus,
I got the below code that it combine sheets from all the files in the folder copy to another workbook, the codes work well. But i want to copy specific columns from all the files, I tried i cannot able to get. Can you help me here please.
I think there is no need for attachment.
Sub MergefilesinaSheet()
Dim myactiveworkbook As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder("C:\Desktop\Merge files\")
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Set myactiveworkbook = Workbooks.Open(everyObj)
Range("A1:AA" & Range("A3000").End(xlUp).Row).Copy
ThisWorkbook.Worksheets("All Columns").Activate
'Do not change the following column. It's not the same column as above
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
myactiveworkbook.Close
CopyColumnsByName
Next
Cells.WrapText = False
Cells(1, 1).EntireRow.Delete
End Sub
Bookmarks