Hi All Forum members,
I have accidentally delete a sheet in old workbook and need to copy all modules to new workbook. When I run macro in new workbook, it tends to open old workbook in the midst of looping folder and copy csv files to current workbook. Is there a way to overcome such scenario ?
I have accidentally delete a sheet in old workbook and need to copy all modules to new workbook. When I run macro in new workbook, it tends to open old workbook in the midst of looping folder and copy csv files to current workbook. Is there a way to overcome such scenario ?
VBA Code:
For Each file In Folder.Files
Set wb = Workbooks.Open(Filename:=file, UpdateLinks:=False, ReadOnly:=True, IgnoreReadOnlyRecommended:=True)
For Each sheet In wb.Sheets
sheet.Copy After:=ThisWorkbook.Sheets(1)
Next
wb.Close False
Next