Excel 2007 VBA to copy sheet to another file if the sheet doesn't already exist

TGarrett

New Member
Joined
Oct 5, 2015
Messages
20
Hi all,

What I am trying to do is copy any worksheets from one file (source) to another workbook (target) which don't already exist in the target file. Is there a way to loop through and compare each of the worksheet names and only copy the new ones while ignoring those that are already in the target? I need to perform this function daily to copy my office's schedule and reformat it for printing. I had it set up to always go to the last worksheet in the source file and copy it to the target but then I learned that two or three new schedules are sometimes dropped at the same time. This is where the looping will come into play. It may take a little bit longer to run but I need to make sure all new sheets are copied and reformatted each time I run the macro. Any help would be greatly appreciated. Thanks.

Tom
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I am still trying to find a solution to this problem. Does anyone have any suggestions? Maybe use an array to compare the sheet names in each workbook and only copy ones that are not already in the target file? Any help would be great.

Tom
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,117
Members
452,545
Latest member
boybenqn

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