Copy values from pivot table to another sheet's empty cells - Macro

Mihaicp

New Member
Joined
May 17, 2018
Messages
1
Hi!

I have this table on sheet "May 2018":

[TABLE="class: grid, width: 500"]
<colgroup><col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:3145;width:65pt" width="86"> <col style="width:48pt" width="64" span="27"> </colgroup><tbody>[TR]
[TD="width: 64"]DAY
[/TD]
[TD="width: 86"]DATE[/TD]
[TD="width: 64"]Sales[/TD]
[TD="width: 64"]Sales Change %[/TD]
[TD="width: 64"]Item[/TD]
[TD="width: 64"]Item Change %[/TD]
[TD="width: 64"]1 Sales[/TD]
[TD="width: 64"]Sales Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]2 Sales[/TD]
[TD="width: 64"]Sales Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]3 Sales[/TD]
[TD="width: 64"]Sales Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]4 Sales[/TD]
[TD="width: 64"]Sales Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]1 Item[/TD]
[TD="width: 64"]Item Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]2 Item[/TD]
[TD="width: 64"]Item Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]3 Item[/TD]
[TD="width: 64"]Item Change %[/TD]
[TD="width: 64"]%[/TD]
[TD="width: 64"]4 Item[/TD]
[TD="width: 64"]Item Change %[/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD]5/7/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"] [/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD="width: 64"]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Tuesday[/TD]
[TD]5/8/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]5/9/2018[/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Thursday[/TD]
[TD]5/10/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]5/11/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Saturday[/TD]
[TD]5/12/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD][/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
[TR]
[TD]Sunday[/TD]
[TD]5/13/2018[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]%[/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[TD] [/TD]
[TD]#REF![/TD]
[/TR]
</tbody>[/TABLE]

And I have this pivot table on "Sheet 1":

[TABLE="class: grid, width: 214"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]Row Labels
[/TD]
[TD]Item[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]1 [/TD]
[TD="align: right"]128[/TD]
[TD="align: right"]A_1
[/TD]
[/TR]
[TR]
[TD]2 [/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]B_1
[/TD]
[/TR]
[TR]
[TD]3 [/TD]
[TD="align: right"]103[/TD]
[TD="align: right"]C_1
[/TD]
[/TR]
[TR]
[TD]4 [/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]D_1
[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD="align: right"]441[/TD]
[TD="align: right"]X_1
[/TD]
[/TR]
</tbody>[/TABLE]

What I'm trying to achieve using Macro is:

X_1 to be copied on Monday "Sales" empty cell
441 to be copied on Monday "Item" empty cell
A_1 to be copied on Monday "1 Sales" empty cell
A_2 to be copied on Monday "2 Sales" empty cell
A_3 ......................Monday "3 Sales" empty cell
A_4........................Monday "4 Sales" empty cell
128 to be copied on Monday "1 Item" empty cell
135 to be copied on Monday "2 Item" empty cell
...and so on.

The next day I want to do the same thing except that I want the values to be saved on Tuesday row.

The pivot table will have the values changed every day, but it won't change it's place on cells.

Can someone help me, please? :)

Thank you very much!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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