Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub MergeDataFiles()
- Dim sPath As String
- Dim MyFile As String
- Dim wBk As Workbook
- sPath = InputBox("Paste File Path Here")
- MyFile = Dir(sPath & "*.xl*")
- Application.EnableEvents = False
- Application.ScreenUpdating = False
- Do While Len(MyFile) > 0
- Set wBk = Workbooks.Open(sPath & MyFile)
- wBk.Sheets(1).Copy After:=ThisWorkbook.Sheets(1)
- wBk.Close True
- MyFile = Dir()
- Loop
- ActiveWorkbook.Save
- Application.EnableEvents = True
- Application.ScreenUpdating = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement