Creating Working Archive Document

red_jon

New Member
Joined
Feb 25, 2016
Messages
7
Hi, im pretty new to excel and vba so please bare with me.

I want to create an archive workbook where I can keep adding tabs every month for reporting purposes.

I only want to copy one particular tab every month from my master workbook into the archive document. This being named as the current month i.e. "January" "February" "March" and so on....

Can anybody guide me to a way of achieving this? I been searching everywhere for the solution.

Note: Having both documents open at the same time is not a problem but would prefer it not to be.

Your help would be much appreciated.

Thanks,</SPAN>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Welcome to MrExcel.

To copy a worksheet into another workbook both source and target workbooks must be open. With the master workbook open, turn on the macro recorder, open the archive workbook and copy the worksheet. That should give you some VBA code that you can adapt.
 
Upvote 0
Hi Andrew,

Thankyou for your rapid response.

I have tried this method, however it overwrites the workbook everytime. I want the ability to keep adding worksheets to the archive workbook month on month without deleting. I have tried many methods and hit a brick wall..my minds gone blank.

Thanks,
 
Upvote 0
Example:<o:p></o:p>
<o:p> </o:p>
Its month January.....My master workbook has a sheet called "Summary Report". I want to then copy this particular sheet into a saved workbook called "Archive.xls" in 'My Documents' directory. The macro method works the first time but when it comes to February and I run the macro it removes January's report and replaces it with February's.<o:p></o:p>
<o:p> </o:p>
I want to keep January's report and then add February's report in the next sheet and so on...<o:p></o:p>
<o:p> </o:p>
I hope this has made things clearer.<o:p></o:p>
 
Upvote 0
If you copy a worksheet whose name already exists in the target workbook Excel appends a number to it. For example if you copy Sheet1 to a new workbook then copy it again to that workbook the second copy will be named Sheet1 (2). Isn't that what you are finding?
 
Upvote 0
No, for some reason it doesn't continuously keep adding new sheets which is what I need it to do. Do you have any code that is similar to what im looking for?<o:p></o:p>
 
Upvote 0
Hi Andrew,

With a bit of playing around this is what I currently have. This seems to be doing what I intended but I would like not to have both workbooks open at the same time.

Code:
Sub copy()
Application.ScreenUpdating = False
    Sheets("Summary Report").Select
    Sheets("Summary Report").copy Before:=Workbooks("archive.xlsm").Sheets(1)
    ActiveSheet.Buttons.Delete
    ActiveSheet.Name = Format(Date, "MMMM")
    ActiveWorkbook.Save
    Application.ScreenUpdating = True
End Sub
Is it possible to open the archive.xlsm in the background, save the intended sheet and then close by using Application.ScreenUpdating? If there is, could you point me in the correct direction?

Thanks,
 
Upvote 0
As i said before you can't do it without having both workbooks open. You could open and close the archive workbook in your current code.

By the way it's not a good idea to give a procedure the same name as a VBA property/method (ie copy).
 
Upvote 0

Forum statistics

Threads
1,217,381
Messages
6,136,229
Members
450,000
Latest member
jgp19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top