I have problem to code macro to select multiple item under a particular field in pivot table.
The criteria for the item being used is coming from a table in another sheet (brand)
Brand
[TABLE="width: 10"]
[TR]
[TD][TABLE="width: 64"]
[TR]
[TD="class: xl65, width: 64"]Brand Cde[/TD]
[/TR]
[TR]
[TD="class: xl66"]AAA[/TD]
[/TR]
[TR]
[TD="class: xl66"]BBB[/TD]
[/TR]
[TR]
[TD="class: xl66"]CCC[/TD]
[/TR]
[TR]
[TD="class: xl66"]BIO[/TD]
[/TR]
[TR]
[TD="class: xl66"]BCL[/TD]
[/TR]
[/TABLE]
[/TD]
[/TR]
[/TABLE]
PivotTableSheet (pick some sample only):
[TABLE="width: 306"]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD]Values[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]CATEGORY[/TD]
[TD]BRAND[/TD]
[TD]Item Code[/TD]
[TD] Jun-17[/TD]
[TD] Jul-17[/TD]
[TD] Aug-17[/TD]
[TD] Sep-17[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120001000[/TD]
[TD] 38[/TD]
[TD] (11)[/TD]
[TD] (22)[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120002000[/TD]
[TD] 85[/TD]
[TD] 33[/TD]
[TD] (6)[/TD]
[TD] 9[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120003000[/TD]
[TD] 70[/TD]
[TD] 14[/TD]
[TD] (8)[/TD]
[TD] 12[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120004000[/TD]
[TD] 116[/TD]
[TD] 41[/TD]
[TD] 7[/TD]
[TD] 35[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120005000[/TD]
[TD] 87[/TD]
[TD] 9[/TD]
[TD] (12)[/TD]
[TD] 6[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120006000[/TD]
[TD] 89[/TD]
[TD] 41[/TD]
[TD] 14[/TD]
[TD] 22[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120007000[/TD]
[TD] 49[/TD]
[TD] 27[/TD]
[TD] (3)[/TD]
[TD] 23[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120008000[/TD]
[TD] 9[/TD]
[TD] 6[/TD]
[TD] 5[/TD]
[TD] 11[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120009000[/TD]
[TD] 103[/TD]
[TD] 41[/TD]
[TD] 3[/TD]
[TD] 30[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120010000[/TD]
[TD] 59[/TD]
[TD] 1[/TD]
[TD] (17)[/TD]
[TD] 6[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120011000[/TD]
[TD] 54[/TD]
[TD] 35[/TD]
[TD] (4)[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120012000[/TD]
[TD] 50[/TD]
[TD] (3)[/TD]
[TD] 3[/TD]
[TD] (2)[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120013000[/TD]
[TD] 77[/TD]
[TD] 28[/TD]
[TD] 2[/TD]
[TD] 10[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120014000[/TD]
[TD] 45[/TD]
[TD] (7)[/TD]
[TD] (4)[/TD]
[TD] 1[/TD]
[/TR]
[/TABLE]
I have tried using looping mechanism (for i = 0 to ...) to pick all the brand.
But it does not work.
The brand name in the table can change dynamically (as per user needs).
Any idea how to solve this?
The criteria for the item being used is coming from a table in another sheet (brand)
Brand
[TABLE="width: 10"]
[TR]
[TD][TABLE="width: 64"]
[TR]
[TD="class: xl65, width: 64"]Brand Cde[/TD]
[/TR]
[TR]
[TD="class: xl66"]AAA[/TD]
[/TR]
[TR]
[TD="class: xl66"]BBB[/TD]
[/TR]
[TR]
[TD="class: xl66"]CCC[/TD]
[/TR]
[TR]
[TD="class: xl66"]BIO[/TD]
[/TR]
[TR]
[TD="class: xl66"]BCL[/TD]
[/TR]
[/TABLE]
[/TD]
[/TR]
[/TABLE]
PivotTableSheet (pick some sample only):
[TABLE="width: 306"]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD]Values[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]CATEGORY[/TD]
[TD]BRAND[/TD]
[TD]Item Code[/TD]
[TD] Jun-17[/TD]
[TD] Jul-17[/TD]
[TD] Aug-17[/TD]
[TD] Sep-17[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120001000[/TD]
[TD] 38[/TD]
[TD] (11)[/TD]
[TD] (22)[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120002000[/TD]
[TD] 85[/TD]
[TD] 33[/TD]
[TD] (6)[/TD]
[TD] 9[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120003000[/TD]
[TD] 70[/TD]
[TD] 14[/TD]
[TD] (8)[/TD]
[TD] 12[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120004000[/TD]
[TD] 116[/TD]
[TD] 41[/TD]
[TD] 7[/TD]
[TD] 35[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120005000[/TD]
[TD] 87[/TD]
[TD] 9[/TD]
[TD] (12)[/TD]
[TD] 6[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120006000[/TD]
[TD] 89[/TD]
[TD] 41[/TD]
[TD] 14[/TD]
[TD] 22[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120007000[/TD]
[TD] 49[/TD]
[TD] 27[/TD]
[TD] (3)[/TD]
[TD] 23[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120008000[/TD]
[TD] 9[/TD]
[TD] 6[/TD]
[TD] 5[/TD]
[TD] 11[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120009000[/TD]
[TD] 103[/TD]
[TD] 41[/TD]
[TD] 3[/TD]
[TD] 30[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120010000[/TD]
[TD] 59[/TD]
[TD] 1[/TD]
[TD] (17)[/TD]
[TD] 6[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120011000[/TD]
[TD] 54[/TD]
[TD] 35[/TD]
[TD] (4)[/TD]
[TD] 15[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120012000[/TD]
[TD] 50[/TD]
[TD] (3)[/TD]
[TD] 3[/TD]
[TD] (2)[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120013000[/TD]
[TD] 77[/TD]
[TD] 28[/TD]
[TD] 2[/TD]
[TD] 10[/TD]
[/TR]
[TR]
[TD]PREMIUM[/TD]
[TD]BCL[/TD]
[TD]010120014000[/TD]
[TD] 45[/TD]
[TD] (7)[/TD]
[TD] (4)[/TD]
[TD] 1[/TD]
[/TR]
[/TABLE]
I have tried using looping mechanism (for i = 0 to ...) to pick all the brand.
But it does not work.
The brand name in the table can change dynamically (as per user needs).
Any idea how to solve this?