I commonly have several workbooks with individual sheets to migrate to a master workbook, think:
- Jan.xlsx
- Feb.xlsx
- Mar.xlxs
- ...
- Dec.xlsx
to a recap on a single sheet named 2020Recap.xlxm. I'd like to build a macro to collect each worksheet and write to the recap workbook, I've started with the VBA script below.
I'm having trouble with the VBA below
I'd like to also add to the macro to use the filename as the sheet name.
Sub CopySheets()
Workbooks("C:\Test\Account AR Aging Patient.xlsx").Sheets("Account AR Aging Patient.xlsx").Copy _
After:=Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets(Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets.Count)
Workbooks("C:\Test\Account AR Aging Payer.xlsx").Sheets("Account AR Aging Payer.xlsx").Copy _
After:=Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets(Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets.Count)
Workbooks("C:\Test\AR History.xlsx").Sheets("AR History").Copy _
After:=Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets(Workbooks("c:\Test\MEBIllingOffice.xlsm").Sheets.Count)
End Sub