Why is this date filter not working?

bcurrey

Board Regular
Joined
Aug 11, 2011
Messages
110
Office Version
  1. 365
Platform
  1. MacOS
I have 3 pivot tables and I'm filtering them by Prior day, Current Month, Current year.

The prior day and the Yearly filters work. I can't get the current month to work (highlighted in red below).

The error I'm getting says "Run-time error 1004. Application-defined or object-defined error"

The month is spelled out in the data I'm using. ex: "October".


Any ideas? I know it's probably something simple.

Thanks!


Code:
   ActiveSheet.PivotTables("PivotTable4").PivotFields("Date").ClearAllFilters
   ActiveSheet.PivotTables("PivotTable4").PivotFields("Date").CurrentPage = (Date - 1)
   
   ActiveSheet.PivotTables("PivotTable5").PivotFields("Month").ClearAllFilters
[COLOR=Red][B]   ActiveSheet.PivotTables("PivotTable5").PivotFields("Month").CurrentPage = MonthName(Month(Date))[/B][/COLOR]
   
   ActiveSheet.PivotTables("PivotTable6").PivotFields("Year").ClearAllFilters
   ActiveSheet.PivotTables("PivotTable6").PivotFields("Year").CurrentPage = Year(Date)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
In your data...

Is the month a Text string e.g. "October" (good)

Or is it a date with a format to display as month (Bad)
10/26/2011 formatted to display as "mmmm" which will look like "October"
 
Upvote 0
Appreciate the response. You helped me find the issue. The month is spelled out as "October" (not a date). However, there are spaces (varying number) after the word.
 
Upvote 0

Forum statistics

Threads
1,215,137
Messages
6,123,252
Members
449,093
Latest member
Vincent Khandagale

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