PDA

View Full Version : Duplicate entire workbook into 3 copies and leave only specific sheets in the copies



lico13
08-24-2018, 02:07 AM
Duplicate entire workbook into 3 copies and leave only specific sheets in the copies
Hi,

I'll be happy if you could help me in a quite simple action to write in VBA code. I tried many ways and didn't succeed to complete the needed action (only partially) due to knowledge gaps in VBA...

I have a Master Workbook containing 5 sheets:
Sheet #1-> Main
Sheet #2 -> Subject A
Sheet #3 -> Subject B
Sheet #4 -> Subject C
Sheet #5 -> Help

I need entire workbook to be duplicated 3 times and after duplication VBA will do the following actions in each copy:

Copy 1 - Name of workbook need to be: Subject_A >>> Only 'Subject A' sheet remains as is. 'Help' sheet need to be hidden. All other sheets need to be deleted.
Copy 2 - Name of workbook need to be: Subject_B >>> Only 'Subject B' sheet remains as is. 'Help' sheet need to be hidden. All other sheets need to be deleted.
Copy 3 - Name of workbook need to be: Subject_C >>> Only 'Subject C' sheet remains as is. 'Help' sheet need to be hidden. All other sheets need to be deleted.

I need that the duplication will be done into the same folder (!) as of the master workbook, with no need to indicate the path of the folder.

Macro should run only from Master Workbook.

Master Workbook need to stay open. All 3 copies need to be close.

Somehow I can't attach anything to my thread...

*** Important note: I need the workbook to be entirely copied and then to the delete & hide actions in the copies, and NOT to copy only the requested sheets into the copies (even if action will be longer and less efficient),
since there are Macro buttons that directing to the master file (not as should be) and conditional formatting that is totally disrupted...

Thanks in advance :)

p45cal
08-24-2018, 05:22 AM
No need to answer, cross posted elsewhere.