Hi
I hope someone can help out with this, please?
I've got some code which imports data from ALL files in a folder into different tabs in one file.
However, I'd like to modify this code (below) so that it does the following:
Imports 6 different files from a folder into 1 Summary file, but pastes the data from those files into 6 different tabs in the Summary file.
So
1) Columns A:H from the 1st file to be imported would be pasted into columns A:H of the 1st tab in the Summary file
2) Columns A:F from the 2nd file to be imported would be pasted into columns A:F of the 2nd tab in the Summary file
3) Columns A:C from the 3rd file to be imported would be pasted into columns A:C of the 3rd tab in the Summary file
4) Columns A:D from the 4th file to be imported would be pasted into columns A:D of the 4th tab in the Summary file
5) Columns A:C from the 5th file to be imported would be pasted into columns A:C of the 5th tab in the Summary file then the last one is different:
6) Columns A:C from the 6th file to be imported would be pasted into columns B:F of the 6th tab in the Summary file
Does anyone know how to do this, please?
I hope someone can help out with this, please?
I've got some code which imports data from ALL files in a folder into different tabs in one file.
However, I'd like to modify this code (below) so that it does the following:
Imports 6 different files from a folder into 1 Summary file, but pastes the data from those files into 6 different tabs in the Summary file.
So
1) Columns A:H from the 1st file to be imported would be pasted into columns A:H of the 1st tab in the Summary file
2) Columns A:F from the 2nd file to be imported would be pasted into columns A:F of the 2nd tab in the Summary file
3) Columns A:C from the 3rd file to be imported would be pasted into columns A:C of the 3rd tab in the Summary file
4) Columns A:D from the 4th file to be imported would be pasted into columns A:D of the 4th tab in the Summary file
5) Columns A:C from the 5th file to be imported would be pasted into columns A:C of the 5th tab in the Summary file then the last one is different:
6) Columns A:C from the 6th file to be imported would be pasted into columns B:F of the 6th tab in the Summary file
Does anyone know how to do this, please?
VBA Code:
Sub FilesInto1SepSheets()
Path = "C:\Users\" & Environ("UserName") & "\Documents\ExcelFilesToImport\"
Filename = Dir(Path & "*.xls")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub