How to create a dynamic macro coding to create pivot table

thlee1122

New Member
Joined
Aug 6, 2015
Messages
8
Could you please tell me VBA coding that I can use to create a dynamic pivot table on a new sheet?

Below is the sample dataset that I want to create pivot table with.

Promotion Name Product Code DC(/Unit)
LG SP-2015Q3-SPIFF-STUDIO-001 LSSG3016ST.BSTESTD 75
LG SP-2015Q3-SPIFF-STUDIO-001 LSMC3086ST.BSBESTD 40
LG SP-2015Q3-SPIFF-STUDIO-001 LSMC3086ST.BSBESTD 40
LG SP-2015Q3-SPIFF-STUDIO-001 LSFS213ST.ASTCNA0 60
LG SP-2015Q3-SPIFF-STUDIO-001 LSFS213ST.ASTCNA0 60
LG SP-2015Q3-SPIFF-STUDIO-001 LSFD2591ST.ASTCNA0 80
LG SP-2015Q3-SPIFF-STUDIO-001 LSFD2591ST.ASTCNA0 80
LG SP-2015Q3-SPIFF-STUDIO-001 LSFD2491ST.ASTCNA0 80
LG SP-2015Q3-SPIFF-STUDIO-001 LSFD2491ST.ASTCNA0 80
LG SP-2015Q3-SPIFF-STUDIO-001 LSMX211ST.ASTCNA0 70
LG SP-2015Q3-SPIFF-STUDIO-001 LSMX211ST.ASTCNA0 70
LG SP-2015Q3-SPIFF-STUDIO-001 LSSB2791ST.ASTCNA0 200
LG SP-2015Q3-SPIFF-STUDIO-001 LSSB2791ST.ASTCNA0 200
LG SP-2015Q3-SPIFF-STUDIO-001 LSSB2691ST.ASTCNA0 200

Could you please help me create a macro coding that creates pivot table of this data into a new sheet and put "promotion name", "product code" in the row label and put "DC(/unit)" in the value section? (I want this code to be dynamic)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,275
Messages
6,171,127
Members
452,381
Latest member
Nova88

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