SHARE
TWEET

Untitled

a guest Jun 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Merger()
  2. Dim bookList As Workbook
  3. Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
  4. Application.ScreenUpdating = False
  5. Set mergeObj = CreateObject("Scripting.FileSystemObject")
  6.  
  7.  
  8. Set dirObj = mergeObj.Getfolder("Path")  'PATH
  9. Set filesObj = dirObj.Files
  10. For Each everyObj In filesObj
  11. Set bookList = Workbooks.Open(everyObj)
  12.  
  13.  
  14. Range("A2:IV" & Range("A65536").End(xlUp).Row).Copy                                         'A65536 is the last row for Colmn A
  15. ThisWorkbook.Worksheets(1).Activate
  16.  
  17.  
  18. Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
  19. Application.CutCopyMode = False
  20. bookList.Close
  21. Next
  22. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top