Hi
I've got some code that imports multiple files into one single file.
However, each file that is imported is put into a separate tab in the single file.
I would prefer to have append the data from the multiple files, instead of having it on separate tabs.
Does anyone know how to modify the code below so that the data from the multiple files would be appended in one single tab in the single file?
Thanks in advance.
I've got some code that imports multiple files into one single file.
However, each file that is imported is put into a separate tab in the single file.
I would prefer to have append the data from the multiple files, instead of having it on separate tabs.
Does anyone know how to modify the code below so that the data from the multiple files would be appended in one single tab in the single file?
Thanks in advance.
Code:
Sub Import()
Dim FolderPath As String
Dim Filename As String
Dim Sheet As Worksheet
Application.ScreenUpdating = False
FolderPath = Environ("userprofile") & "\Desktop\Test\"
Filename = Dir(FolderPath & "*.xls*")
Do While Filename <> ""
Workbooks.Open Filename:=FolderPath & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
Application.ScreenUpdating = True
End Sub
Last edited: