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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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