VBA - Use one input workbook to generate multiple templates

COH123

New Member
Joined
May 10, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Hoping you can help with VBA for the below - been trying to work it out based on other threads but unable to do so.

I have two workbooks:
- One is an 'input' workbook. This has multiple columns (some numbers, some text), running from Column A - Column I (row length will vary) but the important one is Column G. Column G will have text (say e.g. there are 5 rows; 2 might be Called "Text1", 2 "Text2" and 1 "Text3")
- The second workbook is a 'template' workbook. The first sheet in this workbook is called 'Input', and has the exact same column headers as the input workbook above.

What I'm looking for is a macro which:
- Identifies all unique values in the 'input' workbook (so, Text1; Text2; Text3)
- For each unique value identified, generates one copy of the 'template' workbook, with the generated workbook named 'Text1'; 'Text2'; 'Text3' as applicable
- Copies all data from the 'input' workbook into the input sheet in the relevant 'template' workbook (e.g., if Row 2 and 4 were 'Text1' in Column G in the input workbook; copy all of Row 2 and Row 4 into the input sheet in the Text1 template workbook)

If it's easier to combine the two workbooks (so that the 'input' workbook essentially becomes the first sheet in the 'template' workbook, and from that a macro which essentially splits that up into various workbooks aligned with unique values in Column G), that would work also.

Hoping I've explained properly. Any assistance greatly appreciated!

Cheers
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

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