Sorting Pivot Table by date in Macro

michaelfrye

New Member
Joined
Jan 11, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
My Issue:
I'm trying to have the macro sort the pivot table as part of the task.
The data is around 37,000 lines of data with approximately 15 columns. The columns I'm using in the Pivot Table are Date Created, item number, and status.
In creating the Pivot table normally, I use the Date in the Rows, Item Number in the Values and change the value field to a count, and status in the Columns
I change the Group by date to Days and start date of 3 days prior to today (I'm mostly interested in what happened yesterday or the day before... always.

The Pivot now shows like the attachment. PERFECT!

My Problem:
Except I can't get a Macro to sort the start date to 3 days (or some other number) prior to today's date like I can when I manually run the Pivot table. I have the macro currently creating about 10 tabs of data pulling from the same raw data. This is the only part I cannot get to work.

Any help is greatly appreciated!
 

Attachments

  • Item Pivot.png
    Item Pivot.png
    6.1 KB · Views: 6

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Watch MrExcel Video

Forum statistics

Threads
1,123,253
Messages
5,600,544
Members
414,387
Latest member
Vincent88

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