How to make macro copy only most recent months data from a pivot?

Vipor3d

New Member
Joined
Nov 1, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I apologize if this is a dumb question, I'm just not that great with Excel. But I'm hoping to get better.

I'm currently trying to automate part of a process I do for my job that involves copying data from a pivot table and pasting it into another worksheet. However, the pivot table is setup to show cost data by month and each month the previous months costs get added to the pivot, and that's the data I need to copy. Only the most recent month. But I keep having the issue where the macro wants to copy the same column of data each time and not the most recent one. Is there a way to do this like I need?

Also, is there a way to account for additional rows showing in the pivot? For example, if there are 10 cost categories in the rows and then next month there are 12, can a macro be setup to capture all of the cost categories regardless of how many there are?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,578
Messages
5,765,205
Members
425,267
Latest member
bishopc22

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
Top