Hi Everyone,
I would like to copy a sheet end of every month that contains formulas (vlookup) into a another woorkbook but only values and no formulas. So basically this would be an archiving. This two different files are in different folders. My issue is due to the name of the sheet different every month (named by current month, right now is april) i would need to change the name in VBA every month to do the job properly.
My question is how can i specify to copy always the previous sheet in the workbook, and how to specify to place it with the original sheet name to the end of the target workbook?
Thanks for help!
I would like to copy a sheet end of every month that contains formulas (vlookup) into a another woorkbook but only values and no formulas. So basically this would be an archiving. This two different files are in different folders. My issue is due to the name of the sheet different every month (named by current month, right now is april) i would need to change the name in VBA every month to do the job properly.
My question is how can i specify to copy always the previous sheet in the workbook, and how to specify to place it with the original sheet name to the end of the target workbook?
VBA Code:
Dim OutputFile As Workbook
Dim Inputpath As String
Dim Outputpath As String '
Set InputFile = ActiveWorkbook
Set OutputFile = Workbooks.Open("C:\Users\xxxx\Desktop\Archive.xlsm")
InputFile.Sheets("March").Activate
InputFile.Sheets("March").Range("A1:O360").Copy
OutputFile.Sheets("Sheet1").Activate
OutputFile.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
OutputFile.Close savechanges:=True
Thanks for help!