Greetings,
I need to write a macro that merges all the sheets from the ISOHODataCopy1.xls workbook to the zmastertablestest1.xlsm workbook. They are the only two files in the Source_and_Master_Data folder. I have been using this code:
Sub GetISOSheets()
Path = "C:\Users\turner\Desktop\Source_and_Master_Data\"
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
This vba code sucessfully merges the worksheets to the master workbook, but two error boxes appear.
1. File not found: 'C:\Users\name\AppData\Local\Temp\VBF10tmp
2. Run-time erroe '1004': Copy method of worksheet class failed.
The error occurs at this line of code:
Sheet.Copy After:=ThisWorkbook.Sheets(1)
I want to be able to run this macro and another macro at the same time, but the errors prevent this. How can I resolve these errors?
Thanks!!!
I need to write a macro that merges all the sheets from the ISOHODataCopy1.xls workbook to the zmastertablestest1.xlsm workbook. They are the only two files in the Source_and_Master_Data folder. I have been using this code:
Sub GetISOSheets()
Path = "C:\Users\turner\Desktop\Source_and_Master_Data\"
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
This vba code sucessfully merges the worksheets to the master workbook, but two error boxes appear.
1. File not found: 'C:\Users\name\AppData\Local\Temp\VBF10tmp
2. Run-time erroe '1004': Copy method of worksheet class failed.
The error occurs at this line of code:
Sheet.Copy After:=ThisWorkbook.Sheets(1)
I want to be able to run this macro and another macro at the same time, but the errors prevent this. How can I resolve these errors?
Thanks!!!