![]() |
Macro for multiple open files
I am trying to automate a process where I have multiple Excel 'data'
files open and want to take each file individually and add that file to a 'report' workbook where a series of macros run, and then name, save and close the newly created file, and moves on to the next open 'data' file, and the original static workbook remains open. This is all in a 'Do Until' or 'Do While' format so upon completion of the main macro I end up with multiple 'finished' reports. I'm struggling at the beginning and end of this process. I don't know the code that copies an activesheet to an existing 'report' file and then saves and closes the newly created file such that the original 'report file' remains open and ready to use for the next open 'data' file. I greatly appreciate any direction you have... Thank you, Tony |
Macro for multiple open files
Sub MultiPlanStyle()
dim strReportBook as string dim i as integer ' If the Source workbooks are already open and the Target ie Reprt book is also 'open strReportBook="ReportBook.xls" for i=1 to workbooks.count workbooks(i).activate if workbooks(i).name=strReprtbook then else sheets(1).select cells.select workbooks(strReportBook).activate sheets(1).select cells.clear range("a1").select activesheet.paste application.cutcopymode=False Call MainMacro activeworkbook.save workbooks(i).activate end if next end sub " wrote: I am trying to automate a process where I have multiple Excel 'data' files open and want to take each file individually and add that file to a 'report' workbook where a series of macros run, and then name, save and close the newly created file, and moves on to the next open 'data' file, and the original static workbook remains open. This is all in a 'Do Until' or 'Do While' format so upon completion of the main macro I end up with multiple 'finished' reports. I'm struggling at the beginning and end of this process. I don't know the code that copies an activesheet to an existing 'report' file and then saves and closes the newly created file such that the original 'report file' remains open and ready to use for the next open 'data' file. I greatly appreciate any direction you have... Thank you, Tony |
All times are GMT +1. The time now is 06:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com