shwetankbhardwaj
New Member
- Joined
- Apr 26, 2017
- Messages
- 20
Hi,
I have imported multiple excel files into one master workbook but also want imported files to have its actual name instead of Sheet1..2.. and so on. e.g I have imported two files named "Customer name" and "Quantity" but in master workbook these can be seen as Sheet1 and sheet 2. Please help!
Below is the language I have used to Import files & working successfully.
Sub GetSheets()
Path = "O:\Funds\Other\Sales load activity"
Filename = Dir(Path & "*.xlsx")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
I have imported multiple excel files into one master workbook but also want imported files to have its actual name instead of Sheet1..2.. and so on. e.g I have imported two files named "Customer name" and "Quantity" but in master workbook these can be seen as Sheet1 and sheet 2. Please help!
Below is the language I have used to Import files & working successfully.
Sub GetSheets()
Path = "O:\Funds\Other\Sales load activity"
Filename = Dir(Path & "*.xlsx")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub