Create a new workbook for all Unique values and new work sheets tothat new workboks

N

nazmul.bhuiyan

I'm new to VBA and needs to achieve the following task:

I've got a workbook with one worksheet with more then 1000 rows of
data with 185 columns.
There multiple Territory Reps in column E and one/multiple Retailer on
column B. There are one/multiple retailers for each Territory Rep.

I need to create new workbook for each unique Territory_Rep and one/
multiple worksheets on this new workbook.

Finally I’ll have 5 workbooks for Territory Reps and each workbook
will have multiple worksheets for each Retailer that belongs to the
Territory Rep. Each sheet will have calculated figures that would
derived from column Sales1 and Sales2.

Data looks as bellow:

Category Retailer_No Retailer_Name Status Territory_Rep Sales1
Sales2
Cat1 1 Ret 1 Acti Rep
1 100 300
Cat1 9 Ret 2 Acti Rep
2 300 100
Cat1 7 Ret 3 Acti Rep
1 400 200
Cat1 4 Ret 4 Acti Rep
4 100 100
Cat1 5 Ret 5 Acti Rep
3 200 500
Cat1 10 Ret 10 Acti Rep
3 300 100
Cat1 11 Ret 11 Acti Rep
1 600 200
Cat2 6 Ret 6 Acti Rep
2 800 700
Cat2 2 Ret 7 Acti Rep
5 500 500

Sort the table by Territory Rep as below:

Category Retailer_No Retailer_Name Status Territory_Rep Sales1
Sales2
Cat1 1 Ret 1 Acti Rep
1 100 300
Cat1 7 Ret 3 Acti Rep
1 400 200
Cat1 11 Ret 11 Acti Rep
1 600 200
Cat1 9 Ret 2 Acti Rep
2 300 100
Cat2 6 Ret 6 Acti Rep
2 800 700
Cat1 5 Ret 5 Acti Rep
3 200 500
Cat1 10 Ret 10 Acti Rep
3 300 100
Cat1 4 Ret 4 Acti Rep
4 100 100
Cat2 2 Ret 7 Acti Rep
5 500 500

Then create:
Workbook "Rep 1 13-02-2008.xls"
Worksheets "Ret 1", "Ret 3", and "Ret 11"
On each sheet insert a calculated value from the main sheet
e.g. Sales1 + Sales2

Workbook "Rep 2 13-02-2008.xls"
Worksheets "Ret 2" and "Ret 6"

Workbook "Rep 3 13-02-2008.xls"
Create Worksheets named: "Ret 5" and "Ret 10"

Workbook 4 = "Rep 4 13-02-2008.xls"
Worksheets named: "Ret 4" and "Ret 8"

Workbook 5 = "Rep 3 13-02-2008.xls"
Worksheet named: "Ret 7"


Nazmul

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top